Two-Stage Predict+Optimize for MILPs with Unknown Parameters in Constraints

Xinyi Hu, Jasper C.h. Lee, Jimmy H.m. LeeNeurIPS 2023

In real-world decision-making, optimization problems rarely come with perfect information. What happens when the rules of your problem—the constraints—depend on data you haven't seen yet?

Presented at NeurIPS 2023, this paper introduces the Two-Stage Predict+Optimize framework, a generalized approach for training machine learning models to predict unknown parameters within optimization constraints. By modeling post-prediction corrections as a second optimization stage, the authors enable end-to-end training for complex Mixed Integer Linear Programs (MILPs), significantly outperforming previous ad-hoc methods.

The Challenge of Unknown Constraints

In the field of "Predict+Optimize" (P+O), the goal is to train a model not just for statistical accuracy (like minimizing Mean Squared Error), but to produce predictions that lead to the best possible downstream decisions.

Most existing P+O research assumes the constraints are known (e.g., "I have 100 square feet of shelf space") while the objective costs are unknown (e.g., "I don't know the exact profit per item"). In reality, constraints are often the primary source of uncertainty. For instance, a store manager ordering stock weeks in advance doesn't know the exact available storage space they will have upon delivery.

If a constraint parameter is predicted incorrectly, the resulting "optimal" solution might be physically impossible (infeasible) once the true parameters are revealed. Previous attempts to fix this relied on manual "correction functions"—ad-hoc rules to tweak an infeasible solution. These were notoriously difficult to design and largely limited to simple Linear Programs (LPs).

A Two-Stage Solution

To overcome the limitations of manual correction rules, the authors propose a "Two-Stage" approach that treats the initial decision as a soft commitment:

  1. Stage 1 (Prediction & Initial Solve): A neural network predicts the unknown parameters ($\hat{\theta}$). The system then solves the optimization problem based on these predictions to generate an initial solution ($x^*_1$).
  2. Stage 2 (The Correction): Once the true parameters ($\theta$) are revealed, a second optimization problem is solved. This stage finds a final solution ($x^*_2$) that balances the original objective with a penalty for changing or "reneging" on the Stage 1 commitment.

The Training Innovation: Training a neural network end-to-end through this process requires calculating gradients through the optimization steps. Because Mixed Integer Linear Programs (MILPs) are discrete, they are not naturally differentiable. The authors adapt an interior-point approach, utilizing a continuous "log-barrier" relaxation as a surrogate loss. This mathematical bridge allows them to backpropagate the "regret" (the cost of a sub-optimal final decision) directly to the neural network's weights.

Benchmark Datasets

The framework was evaluated on three distinct benchmarks, representing different classes of optimization problems:

  • Alloy Production: A "covering" LP problem where a factory must meet chemical requirements for brass or titanium alloys using ores with unknown concentrations.
  • 0-1 Knapsack (Proxy Buyer Problem): A discrete MILP where a buyer accepts requests to buy items with unknown prices and sizes, facing a penalty for dropping a request later.
  • Nurse Scheduling Problem (NSP): A complex MILP where a hospital must schedule shifts based on unknown patient loads while respecting nurse preferences.
Dataset statistics for the evaluated optimization problems.

Key Insights

  • Optimization as Correction: Letting a secondary optimization stage handle the correction is simpler to implement and mathematically more powerful than human-coded "if-then" rules. The authors prove that this two-stage approach always yields a solution at least as good as any manual correction function.
  • Realistic Soft Commitments: This framework mirrors real-world business operations. You make a plan (Stage 1), and if circumstances change, you pay a "surcharge" or "penalty" to pivot (Stage 2).
  • Generalizing to MILPs: By moving away from specific "packing" or "covering" rules, this method generalizes to any problem that can be formulated as a Mixed Integer Linear Program—a massive class of real-world logistics and planning problems.

Experimental Results

The Two-Stage ("2S") method consistently outperformed both classical regression techniques and previous state-of-the-art optimization frameworks (like IntOpt-C).

Performance comparison of the Two-Stage (2S) method against various baselines on Alloy Production tasks.
  • Alloy Production: The 2S framework reduced "post-hoc regret" by 6% to 35% compared to previous specialized methods.
  • Nurse Scheduling: It outperformed standard neural networks by 7% to 62%, with the performance gap widening as the penalties for schedule changes increased.
  • Robustness: Even in strict scenarios where decisions cannot be changed (an infinite penalty), training with this framework encouraged the model to make "conservative" predictions that were significantly more likely to remain feasible.

Limitations and Future Work

While highly effective, the framework has a few limitations. The current mathematical formulation assumes the optimization objective is linear; extending this to non-linear objectives is a natural next step. Additionally, training requires solving two relaxed LPs for every data point in every epoch. While faster than some competing methods (like CombOptNet), it remains more computationally expensive than simple MSE regression. Finally, the framework is sensitive to hyperparameters, requiring careful tuning of the penalty values and the log-barrier cutoff ($\mu$) to achieve optimal performance.

Summary updated

BibTeX
@inproceedings{hu2023two,
  author = {Xinyi HU and Jasper C.H. Lee and Jimmy H.M. Lee},
  title = {{Two-Stage Predict+Optimize for MILPs with Unknown Parameters in Constraints}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=0tnhFpyWjb},
}
Figure