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

update a constraint with Pulp

Suppose to have a linear program and a constraint of the form: 4 x_1 + 3 x_2 ≤ 10 and that you want to update it to 4 x_1 + 3 x_2 + 10 x_3 ≤ 10 or to 3 x_2 ≤ 10 In order to do that, I "rewrite" the constraint from scratch,…
abc
  • 11,579
  • 2
  • 26
  • 51
3
votes
3 answers

Output of pulp to numpy arrays

I'm using pulp to solve a particular problem which has many variables, with a mixture of 1-D, 2-D and 3-D variables. When the solution is obtained, I would like to get these variables into k-dimensional numpy arrays. Variables: u =…
multipitch
  • 189
  • 2
  • 11
3
votes
1 answer

If-Then-ElseIf-Then In Mixed Integer Linear Programming

I'm trying to frame If-Then-Else-If... conditions in Python's PuLP. I've looked at If-Then and If-Then-Else in MIP. However, I'm trying to understand how to propagate the choices further down to the next set of constraints and how to handle more…
SashaZd
  • 3,315
  • 1
  • 26
  • 48
3
votes
1 answer

Pulp.pulpTestAll() test failed, too many values to unpack

My OS is window 7, Pulp version is 1.6.1, gurobi version is 7.0.1. gurobipy can be successfully imported. pulp.solvers.GUROBI did pass the test, so I could use gurobi. However pulp.solvers.CPLEX_CMD failed. Here is the error…
Lin Sen
  • 93
  • 9
3
votes
1 answer

Linear programming salad mixture optimization with PuLP

I've set up the following LP problem and everything appears to be working except for my percent of mass constraint for salad greens. I want the mass of salad greens to be at least 40%, but I'm getting a syntax error with PuLP's lpSum, and I'm not…
123
  • 8,733
  • 14
  • 57
  • 99
3
votes
0 answers

Assigning flights to baggage handling workstation in Python/PuLP

I am working on fairly big problem and I got stuck. I'll try and simplify it here hoping that someone can give me an idea... Let's assume we have 25 flights (FlightID) departing at different times (TimeIndex) that have to be allocated to 10…
3
votes
1 answer

How do I specify the constraints in PuLP Python for multiplying two variables?

I am trying to model the following Integer Programming model using Python PuLP I have written the following code : from pulp import * #knapsack problem def knapsolve(item): prob = LpProblem('BinPacking', LpMinimize) ys =…
kauray
  • 739
  • 2
  • 12
  • 28
3
votes
1 answer

PyCharm + conda + pip packages not recognized

I can say I am quite new to the world of Python but not to programming. I have been using PyCharm over the last year and I got Python conda distribution to make my life easier with package management. Lately, I have been trying to play with a…
user90772
  • 387
  • 1
  • 5
  • 12
3
votes
0 answers

How can I build a PureScript (*.purs) compiler for MeteorJS?

I want some basic dependencies (Prelude, Console) to test my compiler package. How can I use Bower inside my Meteor package to install those basic dependencies? The "bower.json" example from a "PureScript Book" chapter: { "name":…
focused
  • 314
  • 3
  • 7
3
votes
1 answer

Python Pulp Integer Linear Program with dynamic constraint

I want to solve a mixed integer linear program with the following objective function: J = maximize (f1(x) + f2(x)) subject to constraint: cost(x) <= threshold where x is the set of selected variables, f1 and f2 are two scoring functions and cost is…
CentAu
  • 10,660
  • 15
  • 59
  • 85
3
votes
2 answers

Pulp error +self.path

I am using python to read data from a .xlsm excel file. I have two files that are nearly identical and are saved in the same directory. When I give the python program one excel sheet, it correctly reads the data and solves the problem. However,…
user3204260
  • 115
  • 4
  • 11
3
votes
1 answer

Linear Programming with Python (Pulp) - Scheduling

I'm trying to optimize a schedule by formulating it as an (integer) linear problem. I've run into some problems with the coding part (mostly due to Pulp), which is fairly separate from the formulation. The Problem: Schedule n ships over a period of…
user2777139
  • 51
  • 1
  • 4
3
votes
3 answers

Knapsack in PuLP, adding Constraints on Number of Items selected

I have some puLP code, which solves my knapsack problem. prob = LpProblem("Knapsack problem", LpMaximize) x1 = LpVariable("x1", 0, 12, 'Integer') x2 = LpVariable("x2", 0, 12, 'Integer') x3 = LpVariable("x3", 0, 12, 'Integer') x4 = LpVariable("x4",…
lmasikl
  • 193
  • 2
  • 16
2
votes
2 answers

Shift Scheduling Optimization using Linear Programming in PuLP

I've been working on a workforce scheduling problem using linear programming in Python with the PuLP library. I'm trying to assign employees to different brands, ensuring certain conditions are met. Here's a detailed explanation of the problem and…
davelod
  • 43
  • 4
2
votes
1 answer

Linear programming solver ignore constraints

I am working on a small project to learn linear programming. I have formulated a problem where we want to assign P people to N projects. Each person give a preference, 2 (strongly desired, 1 desired, 0 not desired) for each of the N project. We…