Estimating residential flexibility from smart meter data: A bilevel framework for demand response aggregation | Synapse