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
0
votes
1 answer

How to index the constraints with PuLP in python

I would like to index the constraints in the CPLEX lp file like below: _20160421_LHRSINBA0011_Cap#0: X_20160421_LHRSIN00001_50454 <= 234.5 _20160421_LHRSINBA0015_Cap#1: X_20160421_LHRSIN00002_50464 + X_20160421_LHRSYD00001_60314 <= 114.5 But I…
RUI YU
  • 51
  • 1
0
votes
1 answer

Indexing of variables in Python 3.5 with PuLP

I'm trying to make my code for a linear programming problem a bit more simple. What I have right now is: normal_hours_laptop_01 = LpVariable('Hours for laptop in month 1', 0, 20000) normal_hours_laptop_02 = LpVariable('Hours for laptop in month 2',…
Jeroen
  • 857
  • 10
  • 18
0
votes
0 answers

Identifying best combination of values in an N by N matrix to maximize value of linear objective function in Python

I have an array (I am presenting it as a dictionary) of shifts, where each row is an individual and each shift they qualify for can be multiple. I am using letters in the example to convey how the data matches up. The actual data set is 0 or 1 for…
0
votes
1 answer

Translating Python Code from gurobipy to PuLP in Python

I'm new to PuLP and LP in general. While translating the code meant for gurobipi library so it can be used with PuLP, I am stuck at the following gurobipy code which creates the variables. # Create variables. # x[i, j] is 1 if the edge i->j is on…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
0
votes
1 answer

Pyparsing pulp error

When I try installing ManPy I got the following error message: error: pyparsing 2.1.4 is installed but pyparsing<=1.9.9 is required by set(['pulp']) I checked the Pyparsing setup, but I didn't find the solution.
0
votes
1 answer

Printing indices of 3-dimensional variable in PuLP for scheduling

I am working with SolverStudio (Excel add-in) and PuLP (Python-based optimization language) to create a tool that assigns students to working places. This is the variable whose indices I want to print: # Decision variable, =1 if student s is…
Mark
  • 1
  • 1
0
votes
1 answer

PuLP-OR: Can you delete variables already created?

My question is very simple. Is it possible to delete a variable that I have already created? Or my only hope is to not create the variable to begin with? I guess if you can print a variable then using: del prob.variable would delete it. But I can't…
0
votes
1 answer

How to set the algorithm to barrier when use CPLEX in PuLP

I use 'prob.solve(CPLEX())' to call CPLEX in PuLP. However, I am wondering how to use barrier algorithm here to get a more non-zero solution. Thanks.
RUI YU
  • 51
  • 1
0
votes
1 answer

COIN-OR: What values does a bounded positive integer variable take in an optimization process solved by CBC?

I try to solve a MILP problem with PuLP and CBC. Except for the rest of the problem I face a problem with a set of positive integer variables. I have a constraint with relaxation, meaning that some of the variables in the of positive integer…
0
votes
2 answers

Python quit unexpectedly, Segmentation fault: 11

I have installed python 2.7.12. I used "pip install pulp" to install pulp package. My problem is that "import pulp" gives me the following error. How can I solve this problem. Let me know if you need something else to debug. I have a Mackbook pro…
m0_as
  • 451
  • 1
  • 5
  • 13
0
votes
1 answer

Python Linear Programming

I am trying to solve the following equation: maximize x^{T}Ax where x is a 3 X 1 vector of the variables to be maximized and A is a 3 X 3 matrix of values. So basically x^{T} = [a,b,c] which are the unknowns to be maximized and A could be…
Nikhil
  • 545
  • 1
  • 7
  • 18
0
votes
1 answer

Why does GLPK produce the error `cannot execute glpsol.exe` while the default PuLP solver works perfectly?

While trying to solve a Binary Integer Programming Problem with PuLP and using GLPK as the solver, I get the following error. I have installed GLPK on Windows, set the path as well. The result of pulp.pulpTestAll() shows Solver
kauray
  • 739
  • 2
  • 12
  • 28
0
votes
1 answer

What does AttributeError: 'LpElement' object has no attribute 'cat' and why is this error produced?

I am trying to model the following equation using Python PuLP I have written the following Python Code prob = LpProblem('Resource', LpMaximize) # x variables xs = [LpVariable("x{0}{1}{2}".format(i + 1, j + 1, k + 1), cat = "Binary") for i in…
kauray
  • 739
  • 2
  • 12
  • 28
0
votes
1 answer

Python pulp optimizer with min absolute value

I'm using pulp (https://pythonhosted.org/PuLP/) for optimization purposes and get issue. I need to use constraint like abs(x) > MIN and I found solution here http://lpsolve.sourceforge.net/5.5/absolute.htm, I just create two constraints: x + M * B…
0
votes
0 answers

Integer Linear Programming approximate solution with CBC

I have an ILP (Integer Linear Programming) problem, and am using CBC to solve it. My goal is to compute the best approximate solution in less than 30 seconds. I tried to use the following parameters: maxSeconds = 30 but it doesn't always work.…
Arnaud
  • 4,884
  • 17
  • 54
  • 85