Questions tagged [python]

For questions about solving Operations Research problems using the Python programming language.

Filter by
Sorted by
Tagged with
4
votes
2answers
110 views

Can I use 'SCIP' solver for PYOMO?

I have an MINLP problem to solve where I was initially using 'ipopt' solver but the solution was not sticking to 'binary/boolean/integer' domain type for a variable. I am not sure which free solver ...
1
vote
0answers
46 views

I have a error on installing CPLEX 12.10 to Python 3.8 [migrated]

I am trying to install CPLEX studio 12.10 to Python 3.8. I'm using Visual studio code editor. Referring to https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/...
5
votes
1answer
225 views

Can GLPK be used to solve an optimal team selection problem?

My Problem I am quite new to optimisation, so any advice is appreciated. I am currently trying to solve a problem as follows: Given a pool of people, we want to create n teams such to find the optimal ...
1
vote
2answers
76 views

Issue with number of threads on Cplex

I'm solving a bunch of similar problems and I want to compare them. To do so, I need everything to run on one thread. Even by setting the number of threads to 1, the model still runs on 8 threads. Has ...
1
vote
1answer
53 views

Issues modeling portfolio optimization with rebalancing in gurobipy

I want to solve the following portfolio optimization problem by means of the Python API of Gurobi: I have implemented the problem in the following code: ...
2
votes
0answers
17 views

How to set solver options in Pyomo with GAMS Python API?

Did anyone have experiences with Pyomo and GAMS as solver? I had looked into the pyomo documentation (GAMSShell Solver) and in the CPLEX Manuals, but doesnt find the correct syntax. My Code looks like:...
1
vote
1answer
65 views

Flexible Job Shop Problem with several resources per alternative - Ortools

It has been quite a journey for me to go from 0 to understanding the job shop (js) and the flexible job shop (fjs) examples given by Google's ORTOOLS team. Now the time has come for me to start ...
4
votes
1answer
141 views

Combinatorial Optimisation, Allocation problem

I am trying to solve a problem (in pyspark/ python) where I need to find two distinct values to allocate, and how to allocate them in a network of stores. The two distinct values can only be integer ...
1
vote
1answer
204 views

Mixed integer quadratic programming (MIQP) in CVXPY

There's something I don't understand about CVXPY's example on its MIQP use. It says that the algorithm returns a solution $x \in \mathbb{Z}^n$ but I thought in general the point of MIQP algorithms was ...
5
votes
1answer
82 views

Does pyomo support column generation?

I want to use column generation technique to solve cutting stock problem. Is there any other python modeling library that supports column generation?
4
votes
1answer
93 views

maximum number of BoolVar 's before or-tools is no longer feasible to use

The standard nurse scheduling problem which is used as an example for OR-Tools (see for example https://developers.google.com/optimization/scheduling/employee_scheduling) attempts to assign boolean ...
10
votes
3answers
1k views

Which Python package is suitable for multiobjective optimization

I would like to start using Python for modelling and solving optimization problems. I would like to use both single-objective problems and multi-objective problems with a multidimensional objective ...
-2
votes
1answer
165 views

Optimized Production Planning & Scheduling

I want to create an optimized schedule and production to meet demand of four different buyers. I am starting with Pulp but not able to account for continuous production variable and discrete dispatch ...
0
votes
0answers
108 views

Resource constrained LP problem

I am working on Diet Allocation problem. Where we need to provide food piece for protein deficiency. The data is as below: ...
1
vote
0answers
43 views

CPLEX keeps restarting in Pyomo

I tried running my model by adding the following settings to CPLEX. ...
2
votes
1answer
59 views

How to display the range of coefficients in docplex log?

A typical gurobi log can have a section where it shows the range of coefficients. Something like: ...
1
vote
1answer
88 views

How to balance the workload of teachers in OR-Tools (maximization of the minimum)

I am very new to optimization and OR-Tools. I am trying to solve a very simple question. Let's assume that we have $n$ students. Each student needs to be assigned to only one teacher as a supervisor. ...
3
votes
2answers
106 views

Decision variable transformation in Gurobi

I'm trying to find a way of setting the values of a binary MVar object (which is my decision variable) of size n to {-1,1}. Right now I have a vector that can either take values 0 or 1 (due to binary ...
3
votes
1answer
69 views

View of Constraints and Decision Variables in Pyomo

I have just attempted to construct my first Pyomo model. However, I was unable to locate any documentation that shows how to view constraints, decision variables. As my model is big, I need to see ...
3
votes
1answer
126 views

CPLEX Python API Manual with References

I am currently attempting to code a model using the Python API. However, the IBM Site seems to not have one that is similar in formating and content depth such as those for C++ or Java (examples and ...
7
votes
3answers
405 views

How to find all vertices of a polyhedron

I have a convex polyhedron given by a set of linear inequalities, for example: $$ x_1 \geq 0,~~ x_2 \geq 0, ~~x_3\geq 0 \\ x_1+x_2\leq 1,~~ x_2+x_3\leq 1,~~ x_3+x_1\leq 1 $$ I want to list all the ...
1
vote
1answer
52 views

How to get detail about 'OptimizationStatus.ERROR' in MIP module in Python?

I am using MIP (Mixed Integer Programming) module in Python to solve one of my optimization problems. for some of the scenarios, model returns "ERROR" (OptimizationStatus.ERROR) status after ...
4
votes
2answers
186 views

Output of binary variable greater than one

I am working on a shipping demurrage problem that uses a binary variable to denote the date a specific vessel can be loaded (I have been kindly helped by Wesley on OR before with this). I am confident ...
3
votes
1answer
87 views

Pyomo: Help setting up my model

I have been working with a model for the past couple of weeks, but I am not sure what am I doing wrong as every time Pyomo returns that is infeasible or ...
5
votes
3answers
179 views

How can I optimize this integer programming constraint problem without running out of memory?

I am trying to run this constraint problem but the memory runs out, $$S_{i}$$ are 1975 Students that need to be assigned to one of 188 teacher assistants classes, each teacher assistant has to chose a ...
2
votes
1answer
113 views

Representing Date Variables in Pulp

I am working on an optimisation problem that involves minimising shipping demurrage. I am struggling to model how to represent the difference, (x-y) between dates where the ship is ready to be loaded ...
1
vote
1answer
68 views

Pyomo: Struggling to get a constraint to work

I am trying to model an Electric Vehicle scheduling to minimise the electricity bill. Of course, the EV will only be able to charge every time that is plugged into a charging station (i.e. it cannot ...
3
votes
2answers
569 views

Fast algorithm for Transportation Problem in Python?

Transportation Problem can be solved with simplex algorithm, but it's time demanding. I'm wondering if there exist a specific Python-implemented algorithm with low complexity. Thanks
1
vote
2answers
530 views

Downloading and setting up CPLEX for Pyomo

I have just installed Anaconda and am intending to use Spyder as it is able to display variable, parameter values for debugging. After which, I am planning to use Pyomo to code my MIP model and invoke ...
1
vote
1answer
120 views

Pulp Python: How to formulate a time-based variable for shipping demurrage

I am working on a shipping optimisation problem that aims to minimise demurrage charges as a result of low/insufficient inventory. I have daily vessel requirement (sales) data in the format ...
5
votes
2answers
120 views

Priority List Constraint

I used the Vehicle Routing Problem example that has the objective of minimizing total distance traveled for each vehicle. Suppose that each order to pick up for each vehicle at each node has a ...
2
votes
0answers
91 views

Gurobi is unable to give an optimal solution even when it exists

I am trying to solve Logarithmic Fuzzy Preference Programming (LFPP) for criteria weight evaluation, based on fuzzy comparisons between criteria, and I am solving it with Gurobi in Python 2.7. It is a ...
1
vote
2answers
129 views

Pulp: slack variable to identify & measure extent infeasible in supply problem

I am currently modelling a supply problem that attempts to optimise a rail schedule which moves products from a production plant, to a warehouse to satisfy sales. The model is working fine (thanks in ...
4
votes
3answers
389 views

Branch and bound algorithm programming code

I want to solve an integer programming problem using the branch and bound method, but I'm having trouble finding the programming code. From what I saw, almost all algorithms use it for traveling ...
26
votes
8answers
9k views

MATLAB vs. Python in industry

I am a beginning PhD student in math, and I would like to focus on optimization. I am learning programming for the first time, and I have written out some rudimentary optimization algorithms in both ...
2
votes
0answers
60 views

Efficient way to do user rescaling of variable in Gurobi

Is there a better way than the code below to the rescaling of variable in a model after the model has been build with Gurobi? Like some build in function or a direct manipulation of the column object? ...
4
votes
1answer
77 views

Adding a hard and soft upper bound constraint of number of locations to visit (VRP)

I went through the Vehicle Routing Problem example and was able to replicate it. On the example, there is a constraint added for vehicle maximum distance as shown below: ...
0
votes
1answer
222 views

How to solve knapsack problem with simulated annealing?

I was going through the course contents of Optimization with Metaheuristics in Python in udemy , where they have solved a quadratic assignment problem using Simulated annealing in python , i was ...
8
votes
3answers
977 views

Open source MILP solver for quick “good enough” solution

I have a problem that I have already posted elsewhere in OR.stack, but the question is focused around a large binary MILP (about 1 million decision variables). Ultimately, I am more time constrained ...
4
votes
0answers
93 views

Does anyone have the criss cross algorithm programming code to solve linear programming problems?

I have a project that requires programming code for the simplex algorithm and criss-cross algorithm. The purpose of this project is to compare the two methods. I've tried to find it, but the ...
4
votes
2answers
119 views

Suggest me good books to learn heuristics to solve Operations Research problems using python

Suggest me some good books with implementation of heuristics using python to solve operations research problems
10
votes
3answers
493 views

Settings for a faster solution of a MILP (GUROBI, python)

Using GUROBI with python. When solving a MILP, I notice that the incumbent is very early (25sec) at the optimal point but the best bound is so slow to fall (maximization problem) that it takes ages (...
3
votes
0answers
32 views

Constraint equivalence in PuLP

I'm working on an optimization problem in PuLP and I have to enforce a daily minimum of shifts and a daily maximum of assigned shifts. I have the following constraints to ensure each day has a minimum ...
4
votes
1answer
161 views

How to set these constraints in a linear optimization problem (PuLP)?

I am trying to implement an employee (nurse) scheduling problem and seek some advice on how to implement a specific constraint.The problem is as follows: There is a set of employees and days (both ...
3
votes
0answers
63 views

Problem related to machine's performance while solving an LP-relaxation of a set-covering problem using the Column Generation

PS: I am familiar with performance variability encountered while solving large-scale MIPs. My question may not be explicitly related to it but maybe to the inefficiency of python packages. I have ...
2
votes
0answers
73 views

Branch-and-Price: return gap using SCIP

I implemented a branch-and-price tree in python. I would like to stop the process after 5 hours and return the gap in % between the best integer solution found so far and the optimal solution. How ...
2
votes
1answer
84 views

How to enforce this specific constraint in PuLP?

I am trying to implement an employee (nurse) scheduling problem and seek some advice on how to implement a specific constraint.The problem is as follows: There is a set of employees and days (both ...
4
votes
1answer
107 views

How to make a copy of a Gurobi model in Python?

Suppose I have made a Gurobi model in Python model = Model(), defined variables, constraints, objective function, and solved it. However, I want to make a deepcopy ...
4
votes
1answer
139 views

PuLP Transport Problem - How to add outcomes of decision variables together

I am working on a rail scheduling problem that moves product from a production plant to a storage facility to satisfy demand. I am new to PuLP so finding this difficult to understand why this isn't ...
34
votes
13answers
8k views

Are Python and Julia used for optimization in industry?

I am giving a small computer exercise that aims at teaching students the basics of a modelling language to model small optimization problems. So far I have been using the modelling language GAMS as ...