Questions tagged [pulp]

PuLP is a linear programming module for Python.

PuLP is a linear programming module, written in Python. PuLP supports multiple open-source (e.g. the Coin-OR suite) and commercial solvers (e.g. Gurobi, CPLEX).

The Coin-OR suite with the integer solver CBC is included with the Python package.

Further reading

913 questions
7
votes
1 answer

Binary integer programming with PULP using vector syntax for variables?

New to the python library PULP and I'm finding the documentation somewhat unhelpful, as it does not include examples using lists of variables. I've tried to create an absolutely minimalist example below to illustrate my confusion. import…
Peter Cotton
  • 1,671
  • 14
  • 17
6
votes
2 answers

testing pulp installation fails

Following instructions from http://www.coin-or.org/PuLP/main/installing_pulp_at_home.html#installation , I installed PuLP using "Windows Installation from source" When I tried to run the test on the page ( Instructions on the page : "To test that…
Sriram Samynathan
  • 141
  • 1
  • 2
  • 3
6
votes
1 answer

Defining the Linear Programming Model for Traveling Salesman in Python

Using Python and PuLP library, how can we create the linear programming model to solve the Traveling Salesman Problem (TSP)? From Wikipedia, the objective function and constraints are Problem: Here is my partial attempt where I am stuck. I did…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
6
votes
1 answer

How to get the optimal optimization variables in Pulp with Python?

I am using Pulp with Python to solve an optimization problem. I am using import pulp # code pulp.prob.objective.value() Now, I would like to access the optimization variables. How to do this? In the documentation of Pulp, I found something like…
1-approximation
  • 321
  • 1
  • 4
  • 13
5
votes
1 answer

How can I write an IF condition for my decision variable for Mixed Integer Linear Programming (MILP) using PuLP GLPK on Python?

I am trying to solve an optimization problem using mixed integer linear programming on PuLP with GLPK solver on Python. So far I have been successful solving basic optimization problems with constraints, such as: prob = LpProblem("MILP",…
Muhammad Ali
  • 277
  • 3
  • 11
5
votes
1 answer

Speeding up integer linear optimisation with Pulp

I am trying to solve a massive linear integer optimisation problem (MILP) having more than 45.000 binary variables and ~350.000 constraints. I am using Pulp for solving the problem, but I cannot find the solution in a reasonable amount of time.…
aprospero
  • 529
  • 3
  • 14
5
votes
1 answer

PuLP - How to specify the solver's accuracy

I will try to keep my question short and simple. If you need any further information, please let me know. I have an MIP, implemented in Python with the package PuLP. (Roughly 100 variables and constraints) The mathematical formulation of the problem…
Axel
  • 2,545
  • 2
  • 18
  • 30
5
votes
1 answer

Linear Programming (Simplex LP) PuLP?

In Python only, and using data from a Pandas dataframe, how can I use PuLP to solve linear programming problems the same way I can in Excel? How much budget should be allocated to each Channel under the New Budget column so we maximize the total…
Jarad
  • 17,409
  • 19
  • 95
  • 154
4
votes
1 answer

Is there a faster way to define variables using pulp for linear programming?

Im trying to set up a linear programming problem that involves 3 plants and 4 distribution centers. The goal is to minimize the cost but each plant distribution center combo has a different cost associated. Is there a better way to create variables…
Mikey
  • 47
  • 6
4
votes
1 answer

How to do model.solve() not show any message in python using pulp?

I'm doing a implementation using pulp in python in a code that runtime is very important. #Initialize model model = LpProblem('eUCB_Model', sense=LpMaximize) #Define decision variables y = LpVariable.dicts('tenant', [(i) for i in range(size)],…
Henrique Lima
  • 57
  • 1
  • 5
4
votes
2 answers

pulp.pulpTestAll() :has no attribute 'pulpTestAll'

I just installed pulp and followed instructions here: https://www.coin-or.org/PuLP/main/installing_pulp_at_home.html#testing-your-pulp-installation however it shows the following message: AttributeError: module 'pulp' has no attribute…
minichloe
  • 41
  • 4
4
votes
1 answer

How to fix a code with different results for a linear optimization problem with Pulp Gekko & Scipy package?

I'm setting up a new linear optimization code with Python. Unfortunately, I don't have the same results with Pulp, Scipy and Gekko packages. I tried to implement code with different packages for Linear Optimization in Python. OPTIMIZATION WITH…
4
votes
1 answer

Retrieving multiple optimal solutions with Pulp

I am interested in using Pulp to get multiple optimal solutions if they exist. Much of the literature out there leads me to believe that this is not possible with a programming package, but I did find this promising example. Here is the…
Matt Cremeens
  • 4,951
  • 7
  • 38
  • 67
4
votes
1 answer

Is there a way to see progress of pulp cbc solver on jupyter notebook?

I would like to see the progress of pulp cbc solver on a jupyter notebook. I am trying to solve a very large lp problem with pulp cbc solver, and as it takes hours and even days to find an optimal answer, I would like to know how far the solver has…
Kevin Lee
  • 83
  • 6
4
votes
1 answer

When using pulp cbc solver, can I set priorities for constraints?

I am trying to calculate an optimal answer to a set of binary variables with lots of constraints. I would like to set priorities for the constraints. ex) constraint 1, 2, 3 has priority 100 (highest) and constraint 4, 5, 6 has priority 1 (lowest) I…
Kevin Lee
  • 83
  • 6
1
2
3
60 61