Skip to main content

Questions tagged [pulp]

Questions relevant to the PuLP modelling framework in Python

Filter by
Sorted by
Tagged with
0 votes
1 answer
65 views

How to write conditional constraints and sum the result in Linear Programming in Python?

I want to use the sum of a series of linear expressions as objective and constraints. These linear expressions are chosen to be included or not based on some conditions. I can achieve it in Excel ...
Shwing's user avatar
  • 13
0 votes
0 answers
46 views

Need help for the python scheduling code

I'm working on a Python application using PuLP for optimization, and I'm having trouble ensuring that only one material is produced on a given day. The constraint prob += pulp.lpSum(production_flag[m][...
Beau Ryan's user avatar
0 votes
1 answer
72 views

PULP: Optimization Assignment of Bicycle production per month

Q1. If bicycles of types A and H are produced, then bicycles of type C can be produced with 20% shorter working hours, while selling profit of bicycles type H can be 20% higher. Q2: If bicycles of ...
Ankit Basu's user avatar
1 vote
1 answer
104 views

Unique values constraint in Pulp

Can we directly model following constraint in pulp x != y as following: ...
mufassir's user avatar
  • 211
0 votes
1 answer
70 views

Issue with Mathematical Model Using PuLP Library

I'm working on a pulp python code for the MS-RCPSP (multi-skilled resource-constrained project scheduling problem), I need to update the code to address a specific scenario: when an activity requires ...
John Donald's user avatar
0 votes
0 answers
33 views

Shipment Allocation using Pulp

I am trying to create a model where each shipment must be allocated to a route to minimize the freight cost. I am a complete newbie at LP Optimization. Explanation of dataset: Every destination (D1,...
Jayit Ghosh's user avatar
0 votes
1 answer
46 views

Pulp Optimization with Decision Variable as Boundary

I am currently working on a linear programming problem using the Pulp library in Python. The problem involves optimizing the capacity of a battery, which is represented as a decision variable in my ...
Andreas Schuldei's user avatar
0 votes
1 answer
171 views

PuLP is ignoring constraints, and setting everything to 0 for minimization problem

I have a multi-objective optimization problem I am trying to solve with competing objectives. I am trying to model a network of industrial businesses which can share wastewater rather than sending it ...
Caleb O's user avatar
  • 13
1 vote
1 answer
215 views

Creating a decision variable that is the sum of other variables in PuLP

I'm trying to represent the following problem with PuLP: A car factory needs to maximize profit with an X amount of car models. Each car model has an individual profit and a manufacturing limit, and ...
user avatar
0 votes
2 answers
103 views

Extracting a sequence as a decision variable from a matrix (PuLP)

I am solving a sequencing problem x[i][j], i.e. a binary matrix indicating that product i is followed by ...
Jigeli's user avatar
  • 11
0 votes
1 answer
96 views

Ensure complete cycle in binary succession matrix LP [PuLP]

I have a set of orders N, for which i have to determine an optimal sequence. I wrap this decision within a binary matrix x[i][j], meaning whether i is succeeded by j. For example [[0 1 0 0] [0 0 1 0] [...
QuestioningPanda's user avatar
3 votes
1 answer
270 views

Warm starting a LP problem with PuLP and Gurobi

I have a set of many similar linear programs (LP). All these LPs have the same objective function, and almost all constraints are the same. The only difference is for one linear constraint $f(x)=a_{i}$...
Quentin PLOUSSARD's user avatar
0 votes
0 answers
154 views

Detect presolve status in pulp model

I am running a model using pulp CBC and have few constraints in the model that may make the model infeasible if wrong input is given to the model. I can see while my model runs that in case of ...
Bhavya Budhia's user avatar
1 vote
2 answers
454 views

PuLp is ignoring all of the constraints given to it

I am trying to solve a portfolio optimization problem using PuLP where given a dictionary of stock tickers and their returns for the day, returns a set of weights for each stock such that portfolio ...
Josh Smith's user avatar
0 votes
1 answer
145 views

applying a piecewise linearized equation in pulp

The background is I'm building a toy rent vs. buy mortgage calculator. I am an experienced software engineer but my math skills are 20 years behind me and I admit to being very lost. I've been using ...
kashahkashah's user avatar
3 votes
2 answers
265 views

Binary Integer Programming Problem - Enforce Zeros on Certain Groups

I'm working on a binary integer programming problem using pulp. I have a vector X = [x_1, x_2, x_3, . . . , x_n]. I have enforced a number of simple constraints. I ...
user16668649's user avatar
2 votes
1 answer
113 views

How to linearize the multiplication by a binary decision variable?

I am currently optimizing a hydrogen production chain. I am optimizing the production regime, and the size of the required wind, solar and the electrolyser. For every hour of the year, the production ...
KlaasR's user avatar
  • 23
3 votes
1 answer
195 views

Assignment Problem - Students and teachers

I ran across this problem at work and I'm sure that we can optimize it with OR. I have $n(T) = 4$ teachers and $n(S) = 7$ students that should have a weekly individual class. If a student $s$ has a ...
nickh's user avatar
  • 133
1 vote
2 answers
225 views

Efficient ways to do pairwise/multiplicative variables in integer linear programming on PuLP / Python

I'm trying to formulate an LP that is in essence a variant of the sudoku problem, and I've repurposed the code from https://coin-or.github.io/pulp/CaseStudies/a_sudoku_problem.html. The differences ...
Riezz's user avatar
  • 41
0 votes
3 answers
216 views

Using PULP to model machines in a factory

Complete revision: I have all 4 machines that can run in positive and negative directions which results in 2 outputs: $ P_1 = \begin{cases} -390 \le P_1 \le -300 & \text{for neg mode}\\ 0 &...
sino's user avatar
  • 1
1 vote
3 answers
94 views

PuLP ensure first and last choice

I have an assignment problem where I have $N$ locations and $M$ dates for each location, and the goal is to choose $K$ location-date pairs that maximize revenue. There are a number of constraints, for ...
3Li's user avatar
  • 35
2 votes
3 answers
1k views

Any Idea why PuLP is ignoring binary variables?

When I solve the following code, the binaries for the lines_selection variable is not respected by PuLP. Can anyone please point me out to the reason why this could ...
lalsriv's user avatar
  • 21
-2 votes
1 answer
75 views

Mixed Integer programming - Problem modelling coincidence restriction in scheduling match problem

I am trying to model and solve a problem for maximize audience of matches that must be scheduled in different slots (I am using python PulP library). Below I explain the problem and the model process ...
brtin_'s user avatar
  • 19
4 votes
1 answer
434 views

Understanding reduced costs and dual values

I have a headache regarding calculating the reduced costs of a linear program. I am using Pulp for modelling and CBC for solving. What I do is, I model a linear programming problem based on a rhs ...
Djames's user avatar
  • 1,143
3 votes
2 answers
1k views

Pulp problem gets the right objective value but fails to find the minimal solution

I converted an excel solver problem to Pulp. However, while the pulp program calculates the objective function value correctly, it doesn't arrive at the right answer. I can't figure out what is wrong ...
Murtaza's user avatar
  • 39
1 vote
1 answer
454 views

How to save log file from pulp , log including algorithms used by the solver?

How to save log file from pulp , log including algorithms used by the solver ? while this is printed in the python IDE console, looking to save it as a txt file .
21vs's user avatar
  • 489
1 vote
0 answers
261 views

Problem of optimal solution generated with Pulp

I'm trying to use Pulp to solve VRP problem. Here is the model: ...
MAYA's user avatar
  • 129
-1 votes
1 answer
173 views

Modeling a problem with python pulp transportation problem

I am trying to solve the following problem. How to build a deterministic optimization model for the following fc we have $x_1,x_2,...,x_365$ are the order shipped from an FC to a customer for 365 days ...
Fernando Martinez's user avatar
3 votes
2 answers
296 views

Simple Integer Optimization Problem: docplex CP model works but equivalent PuLP+CBC model is infeasible?

I have an integer optimization problem with one constraint per decision variable and no objective function. It can be coded and solved using docplex, however I am ...
SlowLoris's user avatar
  • 145
2 votes
1 answer
86 views

Split variables into groups, each constrained to hold a specific number of variables, while optimizing group sums towards specific values

I have a number of variables each assigned an integer value. I need to split these variables in three groups with a predefined number of variables going into each group while optimizing towards ...
Hjalte's user avatar
  • 121
3 votes
2 answers
178 views

Find all pivots that the simplex algorithm visited, i.e., the intermediate solutions, using Python

For my research, I am interested in finding the trajectory outlined by the pivots along the way of optimizing an LP problem, but I only know how to use Python PuLP to obtain the optimal solution. Is ...
Miya's user avatar
  • 31
0 votes
2 answers
143 views

Inventory Continuity Equation

I have to minimize the inventory remaining at end of the period(28 days). Each item would perish after a fixed number of days and we can order items only on certain weekdays(M,T,S,S). Demand is ...
Shilpi Bhargava's user avatar
6 votes
1 answer
3k views

How to call HiGHS solver from python PuLP MIP?

I have a large MIP built with PuLP in python, and want to utilize the HiGHS Solver. However, PuLP does not have the option to use HiGHS as a solver. One option I am aware of would be to use PuLP to ...
Mason's user avatar
  • 525
1 vote
0 answers
162 views

Profit Optimization in Python with Difficult Constraints to Maximize Net Revenue

I am currently trying to work on this problem that determines the best constraints on how to place these 'bids'- please see the second column in the screenshot: The ask at hand is to uncover a model ...
mty514's user avatar
  • 11
1 vote
1 answer
310 views

PULP : Constraint violation - multiple of expected value

I am developing a linear programming model in PULP that sends material from Origin Facilities to Transfer and Final Treatment Facilities. The objective function is based on summing the transport and ...
rossb97's user avatar
  • 11
4 votes
1 answer
714 views

Subtour elimination implementation (DFJ) using Python (PULP). While loop never exits

The simple test problem I'm trying to implement is \begin{align} \min &\quad c_{ij}x_{ij} \\ \text{s.t} &\quad \\ &\quad \sum_{j\in N}x_{ij} = 1, \quad i\in N\\ &\quad \sum_{i\...
Parseval's user avatar
  • 207
3 votes
1 answer
1k views

How to formulate cumulative sum of LpVariable in Pulp Python

I have a Multiple product LP optimization problem in which the product(B1,B2,D) will be received in variable quantity with respect to date column. The Optimizer should LP variable Output as Assy Out ...
SrinivasaRamanujam N's user avatar
3 votes
1 answer
715 views

How do I turn off preprocessing in pulp?

there is an inbuilt preprocessing in CBC solver , which affects the optimality of my solution , I get the optimal output by turning this off in command prompt . How do I turn this off using pulp ?
21vs's user avatar
  • 489
-1 votes
1 answer
212 views

I'm trying to solve an OR problem written using pulp framework , with gurobi, in Linux , but I'm not able to solve it

I'm trying to solve an OR problem written using pulp framework , with gurobi, in Linux , but I'm not able to solve it . In windows,I use this command to use gurobi , ...
21vs's user avatar
  • 489
2 votes
2 answers
466 views

Find the list with the fewest elements whose cumulative sum reaches threshold

I have a question with which I am stuck and would be very grateful for help: I have multiple lists of non-negative numerical values (all of the same length) I want to find the list with the lowest <...
birnbaum's user avatar
  • 151
2 votes
1 answer
2k views

Defining Objective Function in PuLP

I have a binary variable $X_{ijk}$ which I have defined as the following : ...
Alphanerd's user avatar
3 votes
2 answers
659 views

Designing a multi-commodity network flow optimizer

I'm trying to solve multi commodity multi source network flow optimization problem using Python-PuLP. Here is how my problem looks like: The numbers on the arcs represent the order of priority a ...
themlchic's user avatar
4 votes
2 answers
759 views

Python Pulp - LpMinimize Not Returning Expected Output - Scheduling Problem

I'm working on my first pulp model and something isn't going quite right. It looks like it's close, but for some reason it is not respecting one of my constraints... It's a scheduling problem and I am ...
t25's user avatar
  • 63
1 vote
1 answer
2k views

Pulp Python - How to define a constraint with different indexes of variables

I am new to modeling LP with Pulp in Python and I need some help with defining a constraint with multiple variables with different indexes. Please see below. The constraint is defined on A, B, C ...
Korean_OR's user avatar
3 votes
1 answer
4k views

Complicated constraint with logical operators in PuLP

I have an optimization problem that I am trying to solve with PuLP. All the variables are Booleans. The variables that are "selected" will be true, all others false. Objective function is ...
Jesse's user avatar
  • 33
5 votes
1 answer
137 views

How to transfer an optimization problem written with GUROBI (in python) in a grammar that can be readily solved with another solver?

Trying to use an opensource optimization tool in python (having used only gurobi for years) I see that the whole code (representing the optimization problem in pythonic language) must be written ...
Makis Karasavvidis's user avatar
6 votes
1 answer
909 views

Python "Coffee Shop Scheduling Problem" - Scheduling Lunches/Breaks

I'm working on an employee scheduling program in python. Having never done this before, I've been researching different libraries that can be used to accomplish the task. Unfortunately, none of the ...
t25's user avatar
  • 63
3 votes
1 answer
424 views

Multi period inventory / reordering MILP in PULP

I'm trying to optimize reorder quantities for $n$ products over $m$ periods in PuLP. The total reorder quantity should fill a container. I've never worked with multiple periods before, and I can't get ...
Jan's user avatar
  • 83
1 vote
1 answer
2k views

Conditional constraints in PuLP

I have the following optimization model using PuLP. ...
gernworm's user avatar
  • 151
2 votes
0 answers
132 views

Seeking help in pulp scheduling problem

I have successfully implemented a program where I allocate N truck drivers to M gathering hubs for each one of the days of the ...
azal's user avatar
  • 153