Abstract
Learning to Optimize (L2O) is a subfield of machine learning (ML) in which ML models are trained to solve parametric optimization problems. The general goal is to learn a fast approximator of solutions to constrained optimization problems, as a function of their defining parameters. Prior L2O methods focus almost entirely on single-level programs, in contrast to the bilevel programs, whose constraints are themselves expressed in terms of optimization subproblems. Bilevel programs have numerous important use cases but are notoriously difficult to solve, particularly under stringent time demands. This paper proposes a framework for learning to solve a broad class of challenging bilevel optimization problems, by leveraging modern techniques for differentiation through optimization problems. The framework is illustrated on an array of synthetic bilevel programs, as well as challenging control system co-design problems, showing how neural networks can be trained as efficient approximators of parametric bilevel optimization.
Introduction
Bilevel optimization represents a "leader-follower" scenario where an upper-level decision (e.g., physical system design) is constrained by the optimal response of a lower-level agent (e.g., system control). These problems are notoriously difficult—often NP-hard—because the constraints of the upper level are themselves optimization problems.
A significant hurdle in this domain is the presence of coupling constraints, which are requirements that bind upper and lower variables together. For example, in engineering co-design, the physical dimensions of a component must allow the controller to achieve specific performance targets. Traditional solvers are often too slow for real-time applications, while existing machine learning approaches struggle to maintain feasibility across both levels of the hierarchy.
Methodology
The proposed self-supervised framework trains a neural network $\mathcal{N}_\theta$ to map problem parameters $p$ directly to solutions $y$. The architecture integrates three core components to ensure differentiability and feasibility:
- Differentiable Lower-Level Solver: By utilizing differentiable optimization layers (such as
cvxpylayers), the model ensures that for any design predicted by the network, the corresponding control strategy is mathematically optimal. - Differentiable Projection Routine: To handle complex upper-level and coupling constraints, the model employs a gradient-based "correction" routine. This routine iteratively nudges the network's initial prediction toward the feasible region during both training and inference.
- Constraint Lifting: To prevent lower-level infeasibility, problematic constraints are "lifted" to the upper level and treated as coupling constraints, ensuring the differentiable solver always operates on a valid sub-problem.
Experimental Evaluation
The framework was evaluated across three distinct problem domains:
- Bilevel Quadratic Programs (BQP): Synthetic benchmarks where ground truth is established via Mixed-Integer Programming (MIP).
- Nonconvex Two-Tank System: A co-design task involving nonlinear fluid dynamics for a pumped-storage hydroelectric system.
- Building HVAC System: A high-dimensional task involving thermal comfort constraints and random disturbances in a two-zone building.
Key Results
The L2O approach demonstrates a transformative improvement in computational efficiency without sacrificing solution quality. On BQP benchmarks, the model achieved a relative optimality gap of only $10^{-2}$ compared to certified optima.
In engineering tasks, the learned models found designs with 15–19% lower costs than the Particle Swarm Optimization (PSO) baseline. The most striking result is the speed: the L2O framework was $\sim 100\times$ faster than MIP for small problems and up to 10,000\times faster than PSO for complex control tasks, as shown in the performance summary below.
Conclusion
This work demonstrates that end-to-end differentiability—from neural network prediction to constraint correction and lower-level solving—allows models to effectively "anticipate" the impact of design choices on controller feasibility. While currently limited to continuous variables, this framework provides a viable path for bringing complex bilevel optimization into real-time applications like robotics and grid management, where traditional solvers are computationally prohibitive.
Summary updated