NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Two-Stage Predict+Optimize for Mixed Integer Linear Programs with Unknown Parameters in Constraints

Xinyi Hu, Jasper C. H. Lee, Jimmy H. M. LeearXiv 2023 · DOI

TL;DR

This paper introduces Two-Stage Predict+Optimize, a generalized framework for solving optimization problems where constraints depend on unknown parameters that must be predicted from data. By treating the correction of an initial "soft" decision as a second-stage optimization problem, the authors provide a universal, end-to-end training method for any Mixed Integer Linear Program (MILP), significantly outperforming previous ad-hoc approaches.

What Problem Does This Paper Address?

In the real world, decisions often must be made before all facts are known. A store manager might order stock weeks before knowing exact customer demand or available shelf space. This is the "Predict+Optimize" (P+O) setting: use machine learning to predict unknown parameters, then plug those predictions into an optimization model.

Most P+O research focuses on unknowns in the objective function (e.g., predicting future stock prices). However, when unknowns appear in the constraints (e.g., predicting available warehouse volume), a wrong prediction doesn't just lead to a sub-optimal result—it can lead to an infeasible one. If you over-order based on a bad prediction, the physical goods simply won't fit.

Previous attempts to handle this required researchers to manually write "correction functions" to fix infeasible solutions, which was tedious and limited to specific problem types. This paper seeks a mathematically "canonical" way to handle uncertainty in constraints for any problem that can be written as a MILP.

Methods

The authors propose a Two-Stage framework:

  1. Stage 1 (Soft Commitment): Predict the unknown parameters ($\hat{\theta}$) and solve the optimization problem to get an initial solution ($x^*_1$). This is treated as a "soft" commitment.
  2. Stage 2 (Correction): Once the true parameters ($\theta$) are revealed, solve a second optimization problem. This stage seeks a final solution ($x^*_2$) that minimizes the original objective plus a penalty for changing the solution from $x^*_1$.

End-to-End Training: To train a neural network for this, the authors use "post-hoc regret" as the loss function—the total cost of the final solution including the correction penalty. Because MILPs are discrete and non-differentiable, they use an interior-point relaxation. By smoothing the problem with a log-barrier function, they can use the Implicit Function Theorem to calculate gradients and backpropagate errors through the optimization solver to the neural network.

Datasets

The framework was evaluated on three distinct benchmarks, varying in complexity and scale.

Characteristics of the optimization problems used for evaluation, showing the significant complexity of the Nurse Scheduling Problem.
  • Alloy Production: A "covering" linear program where a factory must mix ores to meet metal requirements. The metal concentration in the ores is unknown.
  • 0-1 Knapsack: A "packing" integer program where a traveler must pick items to buy based on estimated prices and sizes.
  • Nurse Scheduling Problem (NSP): A complex MILP involving nurse preferences and unknown patient loads. This represents a significant step up in complexity from previous P+O research, involving hundreds of variables and constraints.

Key Results

The "2S" (Two-Stage) method consistently outperformed both standard regression (MSE) and the previous state-of-the-art (IntOpt-C).

Comparison of the Two-Stage (2S) framework against baselines on Alloy Production tasks. The 2S method consistently achieves lower regret across various penalty factors.
  • Lower Regret: In the Alloy problem, the 2S framework achieved 6% to 35% lower regret than previous methods.
  • Better Generalization: On the Nurse Scheduling Problem—which previous constraint-focused P+O methods struggled to handle—the 2S method reduced regret by 7% to 62% compared to classical regression.
  • Efficiency: Despite solving more complex problems, training was 30% to 50% faster than using generic differentiable optimization layers like CvxpyLayer.

Key Insights and Ideas

  • Correction as Optimization: The "aha moment" is realizing that manual correction functions are unnecessary. If we define a penalty for changing a decision, the "correction" is just another optimization problem. This makes the framework applicable to almost any MILP.
  • Universal Feasibility: Even in "hard commitment" scenarios where Stage 2 correction isn't physically possible, this framework remains useful. By setting a massive penalty for change, the model learns to make "conservative" Stage 1 predictions that are highly likely to remain feasible.
  • Differentiating Everything: Unlike prior work that only differentiated through objective parameters, this paper provides the math to differentiate through every part of a MILP: objective coefficients, the constraint matrix, and the right-hand side bounds.

Limitations and Future Work

The primary limitation is that the framework currently requires both stages to be expressible as MILPs (linear objectives and constraints). While MILPs are incredibly versatile, some real-world penalties might be non-linear.

The authors suggest that future work could adapt the gradient calculations for general differentiable non-linear objectives. Additionally, as with all "decision-focused learning" methods, scaling to extremely large-scale optimization problems remains a computational challenge, as the relaxation must be "solved" during every forward pass of the neural network.

Summary updated

BibTeX
@misc{hu2023two,
  author = {Xinyi Hu and Jasper C. H. Lee and Jimmy H. M. Lee},
  title = {{Two-Stage Predict+Optimize for Mixed Integer Linear Programs with Unknown Parameters in Constraints}},
  year = {2023},
  eprint = {2311.08022},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.08022},
}
Figure