Assessment of demand flexibility and response of consumers in electricity demand-response programmes using machine learning methods : PHD thesis