[Paper Review] PyEPO: A PyTorch-based End-to-End Predict-then-Optimize Library for Linear and Integer Programming
PyEPO is a PyTorch-based end-to-end predict-then-optimize library for linear and integer programming that integrates optimization solvers into differentiable training pipelines. It enables direct optimization of decision quality via four state-of-the-art methods, achieving superior decision quality over two-stage approaches in synthetic and real-world problems like shortest path and multiple knapsack.
In deterministic optimization, it is typically assumed that all problem parameters are fixed and known. In practice, however, some parameters may be a priori unknown but can be estimated from historical data. A typical predict-then-optimize approach separates predictions and optimization into two stages. Recently, end-to-end predict-then-optimize has become an attractive alternative. In this work, we present the PyEPO package, a PyTorchbased end-to-end predict-then-optimize library in Python. To the best of our knowledge, PyEPO (pronounced like pineapple with a silent "n") is the first such generic tool for linear and integer programming with predicted objective function coefficients. It provides four base algorithms: a convex surrogate loss function from the seminal work of Elmachtoub and Grigas [16], a differentiable black-box solver approach of Pogancic et al. [35], and two differentiable perturbation-based methods from Berthet et al. [6]. PyEPO provides a simple interface for the definition of new optimization problems, the implementation of state-of-the-art predict-then-optimize training algorithms, the use of custom neural network architectures, and the comparison of end-to-end approaches with the two-stage approach. PyEPO enables us to conduct a comprehensive set of experiments comparing a number of end-to-end and two-stage approaches along axes such as prediction accuracy, decision quality, and running time on problems such as Shortest Path, Multiple Knapsack, and the Traveling Salesperson Problem. We discuss some empirical insights from these experiments, which could guide future research. PyEPO and its documentation are available at https://github.com/khalil-research/PyEPO.
Motivation & Objective
- To address the gap in generic, accessible tools for end-to-end predict-then-optimize in linear and integer programming.
- To enable seamless integration of optimization solvers into deep learning pipelines for decision-aware learning.
- To provide a unified, extensible framework for comparing end-to-end and two-stage approaches across diverse optimization problems.
- To support the use of custom neural networks and solvers, including Gurobi and Pyomo, for broad compatibility.
- To empirically validate the effectiveness of end-to-end learning in improving decision quality using real and synthetic datasets.
Proposed method
- PyEPO embeds optimization solvers into PyTorch’s computational graph using automatic differentiation to enable backpropagation through the solver.
- It implements four core training algorithms: a convex surrogate loss (Elmachtoub & Grigas, 2021), differentiable black-box solver (Pogančić et al., 2019), and two perturbation-based methods (Berthet et al., 2020).
- The library supports defining optimization problems via black-box interfaces or high-level modeling languages like Pyomo and GurobiPy.
- It enables training with custom neural network architectures and loss functions that directly optimize decision quality rather than prediction error.
- The framework supports both continuous and mixed-integer linear programs, with differentiable solvers that compute gradients for model updates.
- Experiments are conducted using synthetic datasets and a Warcraft terrain image dataset, with evaluation on regret and path accuracy.
Experimental results
Research questions
- RQ1Can end-to-end predict-then-optimize outperform two-stage methods in decision quality for linear and integer programs?
- RQ2How do differentiable optimization methods compare in terms of prediction accuracy, decision quality, and training efficiency?
- RQ3Does end-to-end learning provide advantages when features are rich, such as in image-based optimization problems?
- RQ4To what extent can relaxations and regularization improve end-to-end model performance?
- RQ5Can the framework support diverse optimization problems and solvers while maintaining differentiability and training efficiency?
Key findings
- The PFYL method achieved the highest path accuracy (fraction of correct edges in the solution) on the Warcraft shortest path problem, outperforming two-stage and other end-to-end methods.
- End-to-end methods significantly improved decision quality over two-stage approaches on multiple knapsack and shortest path problems, as measured by relative regret.
- On the Warcraft terrain dataset, PFYL achieved competitive results even without access to true cost values during training, indicating strong generalization.
- The two-stage method performed comparably to SPO+ and PFYL on the shortest path task, suggesting that end-to-end learning may not always be necessary for simpler problems.
- The framework demonstrated that regularization and relaxation techniques can enhance end-to-end model performance, particularly in complex or noisy settings.
- PyEPO enables efficient comparison of training paradigms and supports plug-and-play integration with state-of-the-art deep learning models and solvers.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.