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
4
votes
2 answers

MILP model with Python PuLP performance issue - solver is very slow

I've been getting into linear programming in Python latetly, and I created my first optimization alrogithm with PuLP. I am dealing with a scheduling problem for a production process. The goal is to minimize production cost per day, by creating an…
4
votes
1 answer

Converting Excel Solver Solution to Python Pulp

I am finding it hard to convert an Excel Solver model into python pulp syntax. In my model, I am optimizing the HC and OT variables for each department, with an objective of minimizing the sum of the OT variables. The constraints require that the HC…
4
votes
1 answer

Integer Linear optimization with PuLP

I have to solve an integer linear optimization with pulp. I solved the problem and get optimization value equal to 42. But when I wrote the code more general, like declaring variables inside loop, defining constraints inside loop and defining…
KDD Expert
  • 69
  • 1
  • 9
4
votes
1 answer

How to set optimality gap in PULP-OR with CBC solver?

I want to set the optimality gap when calculating a solution between the optimal and the actual solution. I use PuLP version 1.6.1 and I want to pass the parameter of gap to the solver. Does anyone have an example or an idea on how to approach this…
drizo
  • 267
  • 6
  • 14
4
votes
1 answer

Understanding fragments of a Python/PuLP code

I have to adopt an existing script where they used the PuLP package. I need to know how the result of the following line looks like: unit = ["one", "two", "three"] time = range(10) status=LpVariable.dicts("status",[(f,g) for f in unit for g in…
Matias
  • 581
  • 1
  • 5
  • 16
4
votes
1 answer

How do I generate PuLP variables and constrains without using exec?

I have written the following Python Code using the PuLP Library for solving the Knapsack Problem using the Integer Programming formulation. I am using strings to generate the LpVariable commands and add the constraints and then executing them with…
kauray
  • 739
  • 2
  • 12
  • 28
4
votes
2 answers

How to use a variable as a divisor in PuLP

I was trying to resolve a LP problem with a constraint that is calculated by dividing variable A by variable B. The simple version of the problem is as below: The product is made by two materials (A and B) % of A should be greater than 50% % of…
killua8p
  • 304
  • 5
  • 10
4
votes
2 answers

PulpSolverError: PuLP: Error while trying to execute glpsol in Python 2.7

I'm running PuLP on OS X via a iPython notebook and Python 2.7. glpk is installed using brew install homebrew/science/glpk and PuLP is installed via pip install pulp. However I'm getting the error in Python:…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
4
votes
1 answer

pickle not playing nice with PuLP

I'm working in Python 2.7 and using the PuLP library to setup a problem. Once the variables, objective and constraints are defined, I pickle my LpProblem object to send off to a Solver elsewhere. Upon un-pickling my problem, I notice that all of the…
Mike
  • 6,813
  • 4
  • 29
  • 50
4
votes
1 answer

Migrating from PuLP to Scipy

Im using PuLP to solve some minimization problems with constraints, uper and low bounds. It is very easy and clean. But im needing to use only the Scipy and Numpy modules. I was…
Martha Morrigan
  • 109
  • 1
  • 7
4
votes
1 answer

How to simplify repetitive Python PuLP syntax?

How can I simplify the following Python PuLP statements into something more Pythonic, manageable and correct: import pulp as lp #delare variables #Note that I have to model a 100 year period! year_1 = lp.LpVariable("2011", 0, None, lp.LpInteger) …
dassouki
  • 6,286
  • 7
  • 51
  • 81
3
votes
1 answer

Implement Bin Packing problem with additional elastic constraints using pulp optimizer

I am using python as a programming language and implementing a constraint of grouping similar lengths together satisfying the linear programming. Refer to the code shown below import pulp from itertools import product import pandas as pd import…
Tavish Aggarwal
  • 1,020
  • 3
  • 22
  • 51
3
votes
1 answer

How to add conditional constraints to a linear optimisation model in PuLP

I'm new to PuLP and linear programming. I know that there are already some questions about conditional constraints but I just can't wrap my head around it and implement my problem in a linear optimisation model correctly. Basically, I got a variable…
3
votes
2 answers

pulp program for the the following constraint min(a,b) > min(x,y)

Suppose for a moment that I have 4 variables a,b,x,y and one constraint min(a,b) > min(x,y). how can I represent this program in pulp python?
ido kahana
  • 165
  • 2
  • 8
3
votes
1 answer

Implementing specific constraint in Pulp

I have successfully implemented a program where I allocate N truck drivers to M gathering hubs for each one of the days of the week. The constraints I have implemented are: A driver cannot work more than 6 days, i.e. 1 day to rest A driver…
azal
  • 1,210
  • 6
  • 23
  • 43
1 2
3
60 61