Skip to main content

Questions tagged [python]

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

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

Free solver for large LP with warm start and shadow prices

Please advise me a free solver for large linear programming problems that supports warm start can calculate shadow prices simultaneously solving the LP problem has Python interface I considered GLOP ...
Bombaroom Yellow's user avatar
0 votes
0 answers
55 views

Fastest way to solve many systems of integral equations using python

I have a Pandas dataframe that looks like the following: ...
Ishigami's user avatar
  • 101
0 votes
0 answers
46 views

Could I use numpy.arrays to represent the chromosome when solve Job scheduling in GA

I'm trying to solve a Job scheduling problem using a Rank-Based Encoding genetic algorithm that I envision encoding like this: Represent the chromosome as an m x n matrix, each row of the array ...
CangWangu's user avatar
  • 113
2 votes
1 answer
60 views

How can I create a python program that organizes CSV into combinations?

I was directed to this forum by the users at stack overflow as they informed me it didnt fit there. Im trying to create a program that would input a csv file with two lists of plate thicknesses, in ...
PhysicsMajor's user avatar
2 votes
0 answers
103 views

Which OR communities would welcome in a new open source solver for Python?

We've just announced Timefold Solver for Python, a new open source (apache license) solver for Python. We'd love to get some feedback on it's user experience. It's all being build in the open. So I am ...
Geoffrey De Smet's user avatar
0 votes
1 answer
94 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
58 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
0 answers
31 views

Spectral clustering with laplacian matrix eigenvector

I want to separate a given graph in $k$ clusters with the laplacian matrix ($L = D-A$ where $D$ is the degree matrix and $A$ the adjacency matrix). How can the eigenvectors of $L$ be used, along with ...
Sham's user avatar
  • 1
0 votes
0 answers
46 views

Getting solution status as Unknown status value in callback (lazyconstraints) for docplex with Python to solve MILP

from docplex.mp.model import Model from cplex.callbacks import LazyConstraintCallback from docplex.mp.callbacks.cb_mixin import * p_id is the list of lists of customers, n is the set of vehicles, dth ...
Mohammad Samiullah's user avatar
1 vote
0 answers
91 views

what should I do to avoid scipy.minimize solver from computing infeasible models as much as possible

Python==3.9.5, scipy==1.13.0 My model has some variable coefficients in each round of calculation. for example, for a four-dimensional decision variable ...
CangWangu's user avatar
  • 113
1 vote
2 answers
61 views

Improve a heuristic to solve the MS-RCPSP

I'm currently working on developing a heuristic to tackle the multi-skill resource constrained project scheduling problem (MS-RCPSP). I'd greatly appreciate any suggestions or modifications you may ...
John Donald's user avatar
1 vote
0 answers
89 views

Getting error in callback (lazy constraints) for docplex with Python to solve MILP

I am trying to use lazy constraints to solve my MILP problem. The details are given as follows. ...
Mohammad Samiullah's user avatar
0 votes
1 answer
139 views

Minimal example using MOSEK API in python

I want to solve (simplified version) \begin{equation*} \begin{aligned} & \underset{}{\text{find}} & & X\in\mathbb{S}^{n}_{+}, x \in \mathbb{R}^{m}, \nu \in \mathbb{R}, \lambda\...
BasicUser's user avatar
  • 101
0 votes
0 answers
85 views

Linear sum assignment, but with ranked assignments?

Let's say I have 5 tasks that I have to assign to 5 agents, with a cost matrix: ...
Dan's user avatar
  • 1
2 votes
1 answer
329 views

CPLEX 20.1.0.0 and python version 3.10

I am trying to develop in python 3.10, and locally I have cplex 20.1.0.0 installed. It appears to me that the python interface cplex only supports python version 3....
TTY's user avatar
  • 245
1 vote
1 answer
134 views

Unique values constraint in Pulp

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

Could scipy.optimize.minimize be suitable for multi-objectives?

The current model is built using the manner of scipy.optimize.minimize, and now the business needs to transform the model into a multi-objective optimization model. ...
CangWangu's user avatar
  • 113
0 votes
0 answers
107 views

Need Help for building two constraints in MIP model

Really need help for building two constraints with MIP model, I have written the required information and variable information on the diagram below. The way I think of it now is to use two ...
CangWangu's user avatar
  • 113
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
1 vote
1 answer
128 views

A tool for finding integer solutions to linear systems

I have a system of linear equations $A x = 0$, where $A$ is an integer matrix, and I want to find a non-zero solution, if it exists. In that case, a rational solution exists. Multiplying by the common ...
Erel Segal-Halevi's user avatar
1 vote
2 answers
78 views

How to maximise black-box function defined on a subset of integers, with access to its derivative?

The basic form of my problem is as follows. Let $S = \{ 1, 2, ..., 30 \}$. I have an integer-valued function $f$, whose argument is an integer-valued vector $\vec{x} \in S^{200}$. I also know that ...
j x's user avatar
  • 111
-1 votes
2 answers
202 views

How to describe nonlinear programming in gurobipy?

The optimization task The optimization task concerned here is: A square matrix $A\in \mathbb{R^{5\times 5}}$ satisfies the condition: the elements of the first row all are 1, the elements of the ...
138 Aspen's user avatar
  • 222
0 votes
1 answer
259 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
3 votes
1 answer
1k views

Scipy.optimize can't get correct answer when objective is Piecewise Linear Function and Equality Constraint

I'm encountering a puzzling issue with SciPy's minimize function in a constrained optimization problem. My objective is to optimize a piecewise linear function with ...
Yiyuan Chen's user avatar
5 votes
3 answers
626 views

Algorithm needed to find optimum area of 2-dimensional data set

The python script depicted below generates the following toy data set. I need to determine the values for $x_{min}$, $x_{max}$, $y_{min}$, $y_{max}$ describing a rectangular area where the sum over ...
7824238's user avatar
  • 151
3 votes
1 answer
227 views

Implementing Logic-based Benders decomposition on a single search tree

Currently, I am working on a scheduling problem and trying to approach it by the logic-based Benders decomposition method. Theoretically, I have everything, i.e., the master and sub problem(s), the ...
Amir Hosseini's user avatar
8 votes
3 answers
2k views

When are Jupyter Notebooks used to solve optimization problems in Operations Research?

When is it useful to solve an optimization problem inside a Jupyter Notebook? When is it not? What are the advantages/disadvantages?
Geoffrey De Smet's user avatar
1 vote
1 answer
301 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
117 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
  • 19
1 vote
1 answer
180 views

pyinstaller and Pyomo and also SCIP

I would like to package (using pyinstaller) my optimizer program that uses Pyomo and SCIP. I keep getting ...
mathlete42's user avatar
1 vote
1 answer
84 views

Partially modify LHS of a constraint set?

I have implemented a column generation algorithm in Gurobi in Python. The most computationally expensive aspect of this algorithm is the reconstruction of the master problem when a column is added (or ...
mdslt's user avatar
  • 615
-2 votes
2 answers
102 views

Is there existing code for the set partitioning formulation of routing problems?

The set partitioning formulation of routing problems is pretty well-accepted as perhaps the best exact method to solve routing problems. However, these methods are difficult to implement as many ...
IsalanOnkar's user avatar
1 vote
0 answers
369 views

MOSEK via fusion vs API vs CVXPY

In Python, I would like to solve a collection of problems, that are all solvable via MOSEK's conic optimization solvers (ExpCone, SOCP, etc.) I have tried CVXPY. I get very robust and reliable results,...
independentvariable's user avatar
0 votes
0 answers
194 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
2 votes
1 answer
333 views

Gurobipy MILP model comes infeasible yet can't compute IIS because "the model is feasible"

I build a MILP model by Pyomo and use Gurobi 9.0.3 as solver. When the model comes infeasible, I try to use pyomo.contrib.iis.iis.write_iis to compute infeasible ...
CangWangu's user avatar
  • 113
2 votes
1 answer
862 views

Non-proprietary (Python friendly) alternatives to Cplex and Gurobi

I have implemented a pure binary integer combinatorial optimization routine within a Python module (importing gurobipy), and experimented with relaxing a few ...
Cbhihe's user avatar
  • 123
0 votes
1 answer
95 views

Question about IIS output in Pyomo, Gurobipy

These days I try to build a Gurobipy optimization model by Pyomo and I met a problem about outputing IIS file. I use ...
CangWangu's user avatar
  • 113
0 votes
0 answers
57 views

Optimization for a capacity problem

I have a csv file with a table with 5 columns: dueDateTime, cover, phone, simcard, tablet. This file has the amount of items for cover, phone, simcard, tablet. I have the size of the items: we have ...
Andreas K's user avatar
0 votes
3 answers
705 views

Starting with HiGHS

I have been messing about with HiGHS and trying to get a hang of its capability. Here is an example of a simple model from their github repo https://github.com/ERGO-Code/HiGHS/blob/master/examples/...
Erin Walter's user avatar
2 votes
0 answers
39 views

I need help with finding a library or tutorial to parallel optimize given a black box function, assuming it's convex

I have a black box function to optimize with respect to 1-D input,$\beta$, and I also have other inputs, which I don't need to optimize, say (x,y). So, I need to optimize f($\beta$, x,y) over $\beta$. ...
Thiha Aung's user avatar
1 vote
1 answer
818 views

How to get hypervolume calculation for Pareto Front in python?

I hope that this Stack Exchange channel is the right place for this. I'm trying to analyze a multiobjective optimization problem. I'm wanting to use the hypervolume calculation to benchmark the ...
BSplitter's user avatar
  • 145
2 votes
1 answer
272 views

Quadratic optimisation with $\ell_1$ constraints with CVXPY

Crossposted on Mathematics SE I seek to minimize a convex quadratic objective subject to linear and $\ell_1$-based equality constraints. When I turn to CVXPY, an error is raised indicating that it ...
jam123's user avatar
  • 21
1 vote
1 answer
149 views

How to obtain nodes count and nodes left in docplex (using CPLEX 12.20 and Python 3.8)

I solving a MILP problem as given below using Python 3.8 and CPLEX 12.20. I want to obtain the number of nodes and nodes left. The details of the codes are as follows: n_xvars=2 n_yvars=2 #Create ...
Mohammad Samiullah's user avatar
1 vote
0 answers
103 views

Handling Variable Division in CVXPY for Calculating Annualized Rate of Change

I am working with a dataset that contains multiple entries for different IDs across various years. Some IDs might have a gap of years between entries. My goal is to solve an optimization problem using ...
user760900's user avatar
1 vote
1 answer
197 views

Non integer linear objective in or-tools CP-SAT

It seems that or-tools' CP-SAT solvers allows for non-integer coefficients in a linear objective expression. Am I correct, or is it just that the solver doesn't check for integrity and rounds the ...
E. Fischer's user avatar
0 votes
0 answers
101 views

Transforming a quadratic constraint into a linear constraint

I have a problem with a quadratic constraint and I want to transform it into a linear constraint. This would help to reduce the computational time of my problem. Following constraint should be ...
Adri's user avatar
  • 11
0 votes
0 answers
38 views

Error while using subgradient method to update lagrange multipliers

I am trying to implemet the subgradient method in Lagragian relaxation to update the multiplier lamda which has three dimension, I have ecountered an Except error, it looks the is bugs in the code. it ...
ABDE's user avatar
  • 1
1 vote
0 answers
58 views

explain Givens rotation chain for maintaining Cholesky factorization

I'm attempting to implement the dual face algorithm from Pan's book chapter 22 (https://link.springer.com/book/10.1007/978-981-19-0147-8). The part in question is pasted here: Can you please explain ...
Brannon's user avatar
  • 950
2 votes
1 answer
125 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
0 votes
1 answer
112 views

Interpret the formulation of a pricing model in crowdshipping

I am trying to run the pricing model from the paper "Designing pricing and compensation schemes by integrating matching and routing models for crowd-shipping systems" on python with Gurobi, ...
Last_Mile's user avatar

1
2 3 4 5
9