Learning Linear Programs from Optimal Decisions

Yingcong Tan, Daria Terekhov, Andrew DelongNeurIPS 2020

In many fields—from economics to logistics—we frequently observe agents making "optimal" decisions, such as a customer choosing a product mix or a routing algorithm picking the fastest path. We often assume these agents are solving an internal optimization problem, but we rarely know their exact costs or the constraints they face.

Inverse Optimization (IO) is the field dedicated to inferring these hidden parameters from observed data. However, most existing IO methods are limited: they might only learn costs while assuming constraints are fixed, or they only work for highly specific problem types. The core challenge is that this is a bilevel problem. To find the best parameters (the "outer" problem), you have to solve the underlying linear program (the "inner" problem) every time you update your guess. This process is fraught with mathematical landmines, such as parameters that lead to empty feasible regions or situations where multiple different decisions are equally "optimal."

To address this, researchers have developed a flexible, gradient-based framework to "reverse engineer" linear programs (LPs) by observing the optimal decisions they produce. By treating the problem as a bilevel optimization task and differentiating through a custom PyTorch-based solver, they can jointly learn costs, constraints, and parameters, significantly outperforming traditional gradient-free methods.

The Inverse Linear Optimization Problem (ILOP) Framework

The authors propose a general framework called the Inverse Linear Optimization Problem (ILOP). Instead of learning static numbers, the model utilizes Parametric LPs (PLPs) to learn functions that map input features (like weather or prices) to LP coefficients (costs and constraints).

To train the model using gradients, the researchers implemented a batch-mode homogeneous interior point algorithm in PyTorch. This differentiable solver allows them to calculate exactly how the "optimal decision" changes as the model parameters change. They use the Sequential Quadratic Programming (SQP) algorithm—specifically SLSQP—as the "outer" solver. Unlike simpler gradient-descent methods, SQP is robust enough to handle the non-convex landscapes and constraints inherent in learning an optimizer.

The team compared four ways to obtain gradients:

  1. Backprop: Stepping backward through the solver's iterations.
  2. Implicit: Using the KKT optimality conditions.
  3. Direct: A closed-form derivative specifically for objective error.
  4. CVX: Using the cvxpylayers library.

Notably, they found that for specific loss functions (like Absolute Objective Error), their "direct" gradient derivation acts as a massive speed hack, running ~50x faster than backpropagating through the solver or using implicit differentiation.

Key Insights: Joint Learning and the Feasibility Trap

One of the most significant breakthroughs of this framework is demonstrating that joint learning is possible. You do not have to choose between learning costs or constraints; you can learn both simultaneously by treating target feasibility as a hard constraint in the outer optimization loop.

This leads to a critical concept the authors call the "Feasibility Trap." A naive model might find a cost vector that makes an observation look "optimal" even if that observation is actually outside the feasible region. The ILOP framework explicitly prevents this by enforcing target feasibility.

The "Feasibility Trap" in parameter space. The model must find parameters (w3) where the target is feasible and the objective error is small, avoiding regions where the target is infeasible (w1) or the error is large (w2).

However, the authors note that generalization remains tricky. Because the mapping from "features" to "optimal decisions" in an LP is discontinuous (the solution "jumps" from one corner of the feasible region to another), models can easily achieve zero error on training data but fail on new test cases.

Experimental Results

The authors evaluated their framework on two main types of data: randomly generated Synthetic LPs (up to 10 variables and 80 constraints) and a classic Minimum-Cost Multi-Commodity Flow network problem based on the Nguyen-Dupuis graph.

In high-dimensional tasks where many parameters need to be learned, gradient-based SQP methods proved vastly superior. They succeeded in finding the correct model ~60-65% of the time, while gradient-free methods like COBYLA or Random Search almost entirely failed.

Comparison of optimization paths between gradient-based SLSQP and gradient-free COBYLA. SLSQP navigates the landscape efficiently, while COBYLA struggles with infeasible evaluations and fails to converge directly.

Furthermore, on the multi-commodity flow task, the SQP methods successfully recovered complex, non-linear cost functions (involving sine waves for time-of-day effects) that were completely invisible to baseline methods. The custom PyTorch implementation also allows for batching multiple LPs at once, making it highly efficient and practical for modern machine learning pipelines.

Limitations and Future Work

While powerful, the current formulation assumes that the observed decisions are perfectly optimal and feasible. Extending this to handle "noisy" or sub-optimal observations—which are incredibly common in real-world human data—is a vital next step.

Additionally, because the outer problem is non-convex, the solver can get stuck in local minima. The authors currently rely on "multi-start" strategies (running the solver from different random points) to find the global optimum. Finally, while the framework supports regularization, further research is needed to determine which specific types of regularization best help these models generalize to unseen conditions.

Summary updated

BibTeX
@inproceedings{tan2020learning,
  author = {Yingcong Tan and Daria Terekhov and Andrew Delong},
  title = {{Learning Linear Programs from Optimal Decisions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
}
Figure