Sourcify
Effortlessly find and manage open-source dependencies for your projects.

A Python linear programming API for creating and solving optimization problems.

PuLP is a Python library that facilitates the creation and solution of linear and mixed-integer programming (MILP) problems. It acts as a modeler, enabling users to define optimization problems in a Pythonic way and then solve them using various open-source or commercial solvers. PuLP can generate MPS or LP files, allowing for solver interoperability. It supports solvers like GLPK, COIN-OR CLP/CBC (included by default), CPLEX, GUROBI, MOSEK, XPRESS, CHOCO, MIPCL, HiGHS, and SCIP/FSCIP. The library offers essential classes, like LpProblem for defining problems, LpVariable for defining variables with constraints, and LpConstraint for setting limitations. With functions like value() to get variable values and lpSum() or lpDot() for creating linear expressions, PuLP allows efficient model formulation, making it useful for resource allocation, scheduling, supply chain optimization, and other decision-making problems.
PuLP is a Python library that facilitates the creation and solution of linear and mixed-integer programming (MILP) problems.
Explore all tools that specialize in constraint optimization. This domain focus ensures PuLP delivers optimized results for this specific requirement.
PuLP supports integration with various open-source and commercial solvers, including CBC, GLPK, CPLEX, Gurobi, MOSEK, XPRESS, HiGHS, and SCIP. This allows users to choose the best solver for their specific problem type and size.
PuLP can generate MPS or LP files, which are standard formats for representing linear programming models. These files can be used with any solver that supports the format, enabling interoperability and model sharing.
PuLP allows users to define optimization models using Python syntax, making it easy to create complex models with loops, conditional statements, and other programming constructs.
PuLP supports column-wise modeling, which allows users to construct the model column by column, rather than row by row. This can be more efficient for large-scale models with many variables.
While PuLP primarily focuses on linear and mixed-integer programming, it can be extended to handle constraint programming problems by integrating with constraint programming solvers.
Install Python 3.9 or newer
Install PuLP using pip: `python -m pip install pulp`
Install preferred solver (e.g., CBC is default)
Import PuLP: `from pulp import *`
Define LpProblem: `prob = LpProblem("myProblem", LpMinimize)`
Define LpVariables: `x = LpVariable("x", 0, 3)`
Add constraints to the problem: `prob += x + y <= 2`
Set the objective function: `prob += -4*x + y`
Solve the problem: `status = prob.solve()`
Check solution status: `LpStatus[status]`
Retrieve variable values: `value(x)`
All Set
Ready to go
Verified feedback from other users.
"PuLP receives generally positive reviews for its ease of use and flexibility in defining and solving linear programming problems."
Post questions, share tips, and help other users.
Effortlessly find and manage open-source dependencies for your projects.

End-to-end typesafe APIs made easy.

Page speed monitoring with Lighthouse, focusing on user experience metrics and data visualization.

Topcoder is a pioneer in crowdsourcing, connecting businesses with a global talent network to solve technical challenges.

Explore millions of Discord Bots and Discord Apps.

Build internal tools 10x faster with an open-source low-code platform.

Open-source RAG evaluation tool for assessing accuracy, context quality, and latency of RAG systems.

AI-powered synthetic data generation for software and AI development, ensuring compliance and accelerating engineering velocity.