PuLP is a Python library for building linear and mixed-integer programming models. It connects models to many open-source and commercial solvers.
Overview
PuLP is a modeler for linear programming and mixed-integer linear programming problems in Python. You define decision variables, objectives, and constraints in code, then hand the model to a solver backend to obtain a solution.
The library can export models as MPS or LP files and invoke a wide range of solvers, including GLPK, COIN-OR CBC and CLP, HiGHS, SCIP, OR-Tools CP-SAT and GLOP, Clarabel, and interfaces to commercial engines such as CPLEX, Gurobi, MOSEK, and Xpress. Optional PyPI extras install solver bindings; CBC is not bundled inside PuLP itself and is usually obtained via an optional CBC extra or a CBC executable on your PATH.
Typical workflow centers on LpProblem, variables added with addvariable, linear expressions and constraints, and solve returning solution statistics. Helper functions build sums and dot products of variables. The package is part of the COIN-OR ecosystem and ships with documentation, case studies, and import/export guides for models.
Solvers are selected explicitly or by default when a suitable open-source backend such as CBC is available. listSolvers reports known APIs and which ones can run on the current machine, mixing command-line executables with native Python APIs.
Key features
- LpProblem modeling API
- Mixed-integer and binary variables
- Many solver backends
- MPS and LP export
- Optional solver PyPI extras
- lpSum and constraint helpers
- COIN-OR project member
Use cases
- Blending and transport LP models
- Sudoku as integer programs
- Supply chain MIP planning
- Solver comparison from one model
- Teaching optimization in Python