khalil-research/PyEPO
A PyTorch-based End-to-End Predict-then-Optimize Library for Linear and Integer Programming
What it solves
PyEPO is designed for "predict-then-optimize" problems. In these scenarios, a machine learning model predicts the coefficients of an optimization problem (like costs or weights), which are then used to find an optimal solution. Traditionally, models are trained to minimize prediction error, but PyEPO allows training the predictor based on the quality of the final decision (regret) rather than just the accuracy of the prediction.
How it works
PyEPO provides a framework that integrates optimization solvers with deep learning frontends (PyTorch and JAX). It uses gradient surrogates to backpropagate through the non-differentiable optimization layer, allowing the predictor to be trained end-to-end. The library includes a symbolic DSL for defining linear programs (LPs), mixed-integer programs (MIPs), and quadratic objectives, which can then be compiled to various solver backends.
Who it’s for
It is intended for researchers and practitioners in operations research and machine learning who need to integrate predictive models with downstream decision-making processes, specifically for linear and integer programming.
Highlights
- Diverse Gradient Surrogates: Supports seven families of losses, including surrogate losses (SPO+), perturbed methods (DPO, PFYL), regularized methods (RFWO), black-box methods (DBB, NID), cone-aligned estimation (CaVE), contrastive methods (NCE), and learning-to-rank (LTR).
- Multi-Solver Backend: Compatible with Gurobi, COPT, Pyomo, Google OR-Tools, and the GPU-native MPAX solver.
- Symbolic Modeling: Features a
pyepo.dslfor defining optimization problems once and compiling them to different backends. - GPU Acceleration: Integrates with MPAX for batch solving of linear and quadratic programs on GPUs.
- Performance Optimizations: Includes parallel solving via Pathos and solution caching to reduce redundant solver calls.
Related
- Project
- Project
- Project
- Project