Questions tagged [pulp]

PuLP is a linear programming module for Python.

PuLP is a linear programming module, written in Python.

Further reading

661 questions
-1
votes
1 answer

Add quantity as a constrain in the blending optimization problem

I´m replicating this example of the blending problem: https://www.coin-or.org/PuLP/CaseStudies/a_blending_problem.html With the following data: import pulp from pulp import * import pandas as pd food = ["f1","f2","f3","f4"] KG =…
-1
votes
1 answer

Create constraint in Python Pulp to limit consecutive streak of 1s to 1

I would like to add a constraint to my optimization problem that I am building using pulp. The constraint should count the number of "streaks" of non-zero numbers, i.e., [1,1,1,1,0] = 1 because there us 1 group of 1s [1,1,1,0,1] = 2 because there…
-1
votes
1 answer

Python Pulp - Avoiding Duplicated Entries In Solution

Thanks ahead for your time! I have the following data: Name Group ID Grade Bill A 1 89 Jill A 2 70 Bob A 3 99 Chad A 4 5 Molly B 5 12 Bill …
-1
votes
1 answer

Formulate square of a function in Mixed Integer Linear Programming using pulp

I have a linear equation Ax = b. I am trying to minimize (Ax-b)^2 using pulp in Python. Dimensions of A are (1000, 500) and b is (1000,). So far I have tried this: import pulp mse = pulp.LpProblem("Example_Problem", LpMinimize) vars =…
msksantosh
  • 185
  • 1
  • 14
-1
votes
1 answer

Writing Constraints in PuLP

I'm trying to write the following constraints in PuLP. Choose between A and B; I can select atmost one and can't select both. There are a total of 10 variables A-J. Out of A-F, I have to select at least 3 in my solution. Can you please…
aseem puri
  • 51
  • 5
-1
votes
1 answer

Tkinter entry arguments : takes 0 positional arguments but 7 were given

I'm trying to create a program using PuLP library that when you hit the button it solves a linear problem and outputs values. So this is what I get when I tried to optimize my input values: TypeError: problem() takes 0 positional arguments but 7…
M.Malah
  • 21
  • 2
-1
votes
1 answer

Python Constraint

I am looking to find the best replacement item for an old item. An old item can have several potential options for replacement items. I want to only choose one replacement item for each old item. So in data form lets say that the color is the old…
-1
votes
1 answer

How to create decision variables in R for linear programming?

How should i create a list of n variables indexed by nth index(string - key) For example X['one'] should be treated as decision variable with index value 'one'. After creating the decision variable - Assuming there are two decision variables X(list…
-1
votes
1 answer

PYTHON, if-statement meets only first condition. PuLP

I am trying to use PuLP to optimize a system, minimizing the cost of it. I am using multiple If's and the problem is that it always meets the first condition. Here is my code. I hope someone can help me, as I am just starting to learn about this…
-1
votes
1 answer

how to use pulp to generate variables and constraints of sparse matrix?

there, I am new to pulp. I learn pulp from some examples I got online. These examples are very helpful and now I am able to write simple models by mtself. But I still feel difficult to build complex model, especailly model with sparse matrix. Could…
liywliyw
  • 11
  • 3
-1
votes
1 answer

Getting error while solving LPP in python

The script I am using for solving LPP is following: Script: # Import PuLP modeler functions from pulp import * # Create the 'prob' variable to contain the problem data prob = LpProblem("The Whiskas Problem",LpMinimize) LpVariable("example", None,…
chunky
  • 65
  • 1
  • 1
  • 10
-2
votes
1 answer

How do i fix "invalid error" in python 3?

My programm show one error about syntax of the following line code: runfile('D:/Mon Amour/Codes HPP and Thermal/My World/codes of hydro/Gurobi_python_hydro_scheduling/Gurobi_Python_Hydro_Scheduling-master/SDDP_Model.py', wdir='D:/Mon Amour/Codes HPP…
-2
votes
1 answer

Scipy and pulp which will be better if using cplex solver

Which among python libraries like pulp and Scipy , has the capability to work with Cplex solver .If we have huge constraints and datasets for optimisation in supply chain .
-2
votes
1 answer

How solve this MILP problem with Pulp Python module?

I think I'm facing a Milp problem but I'm not sure. The problem in a simplified form is: There are 3 suppliers of materials (trucks) for 3 cities. The real problem is 30 Suppliers and 100 cities... Supliers capacity: a:1; b:2; c:3. Cities Demand:…
-2
votes
1 answer

Converting Julia JuMP to Python PuLP

I stumbled upon a piece of software that I'd like to convert from Julia to Python (don't have much experience with Julia). The main problem I'm having is I don't understand exactly what is going on in the section I've marked with comments #PROBLEM…
1 2 3
44
45