# Questions tagged [python]

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

187 questions
Filter by
Sorted by
Tagged with
44 views

### Print Intermediate Solutions of Scheduling Problem and tackling FLAGS in jupyter notebook

I tried this code and it goes on and I'm clueless when it'll end so I manually interrupt it. Is there any way we can see intermediate solutions that are feasible solutions and can we limit time or ...
87 views

### Multiple Depot/Crew Office Bus Driver Scheduling Modelling

I'm working on Bus Driver Schedule with multiple add-on constraints that are complex and hence trying to figure out how this can be achieved. Reference of Bus Driver Scheduling using OR-Tools:- https:/...
71 views

### Variable vector violates upper and lower bounds when I hit iteration limit

I have an application where I want to monitor the variables over time. I declare all the variables in my model like this: ...
53 views

### Calculating the Obj Value manually in Gurobi

I have been working on the problem on Facility Location Problem with Gurobi using the example provided by the Gurobi team. ...
77 views

### Violation of specific constraint in Pulp

I have successfully implemented a program where I allocate N truck drivers to M gathering hubs for each one of the days of the ...
66 views

### Optimisation Multiple Constraints

I am trying to solve a linear algebra problem: an optimisation problem and I am using CVXOPT. I've split the problem into 3 components In its simplest form, The general formulation for CVXOPT is \...
2k views

### What are technologies or libraries which greatly improve the speed or ease of use for delivering of OR software?

There are many great technologies/libraries out there to improve the speed and quality of implementing and deploying OR applications. However in my experience i "stumbled" upon many of them ...
473 views

### How to run MOSEK solver in CVXOPT

I have written a small code to do a simple min variance optimisation using CVXOPT, you can see the whole code below By using solvers.qp(P, q, G, h, A, b) in CVXOPT ...
132 views

### How to simplify the following constraints as I'm using MIP optimization solver in python?

Following is the initial snippet of the code: ...
115 views

### How to make the solution of linear programming within the specified elements [duplicate]

The constraint value of a variable must be an element of the specified list.A simple example is shown as follow,in which the value of the...
110 views

### Gurobi: How to define constraints that can accept multiple different values？ [duplicate]

I have a question about Gurobi. How do I define a constraint that can accept multiple different values? For example, a sample constraint is shown as follows: ...
82 views

### How do I define multiple indices for the same set in python? (using CPLEX to solve a MILP)

I am using docplex in Python to solve a MILP and I am having some trouble defining the indices and sets of my model. I want to translate $w,v,a\in W$ into Python. In this case, $W$ is a set, and $w, v$...
161 views

### How to make the elements of the solution of gurobi belong to the elements of the specified list?

If I want to use the elements of the list as the range of the solution, like list1 = [10,20,50,60,30],and the elements of the solution must belong to the elements of the list The sample example as ...
36 views

### gurobipy.GurobiError: Second argument should be a list of Var

The following error was encountered when using LinExpr in gurobi: ...
67 views

### How can I set the solution of gurobi to be a multiple of 10 instead of all integers?

For example, the solution for gurobi has two solutions, as follows: [10,20,50,70] [55,79,30,80] I only want to output solutions that contain only multiples of 10. The sample example as follow: ...
102 views

### Obtaining solver timings from Pyomo

I would like to seek some advice on the following: I am currently using Pyomo to generate my MILP model in Pyomo and solve it using Gurobi, respectively. As the solution process is iterative, I would ...
42 views

### Solver issue? Xpress (slp) - Nonlinear - Python - Pyomo

I tried solving my model with xpress: pip install xpress And then in the model: ...
91 views

### How to display results of 2-dimensional Pyomo variables in a pandas dataframe

I would like to create a pandas dataframe from the results (and the parameters) of an optimization problem and create a csv file out of it. In my previous example (1-dimensional case) I have just one ...
105 views

### Find multiple solutions using pyomo and gurobi

I am solving a MILP using Gurobi and Pyomo. I would like to obtain as many optimal solutions as possible. Here is what I have so far: ...
99 views

### Capacitated Maximum Coverage Location Problem, Python and Gurobi

I am building a variant of the maximum coverage location model and want to limit the amount of points that each "facility" can cover. I am using Gurobi optimization . I have tried using the ...
49 views

### How to create constraint-equations in Pyomo with empty set inputs

I would like to crate an constraint-equation that depends on 4 sets. For that I use the following code: ...
50 views

### How to assign values from a list of dictionaries to a 2-dimensional parameter in Pyomo

I know how to assign values from a single dictionary to a 1-dimensional parameter in Pyomo. For that I use the following code ...
76 views

121 views

### Dynamic Programming - Formulating recurrence relation

We wish to apply dynamic programming techniques to find the optimal betting strategy for a pool to wager on the outcome of the NCAA men's basketball tournament 64 teams compete in a single ...
81 views

### Job Shop Scheduling Problem: jobs are scheduled on the same machine at the same time

I want to solve a job shop scheduling problem. I got $n$ Jobs that have to be scheduled on $k$ Machines. A Job $i$ has 2 or 3 Tasks $j$, and there is a known sequence of the Tasks of a Job. One ...
103 views

### Impose binary constraint on integer matrix with CVXPY

So I have the following matrix: $$P_{i,j}= \begin{bmatrix} x_0 & x_1 & x_2 \\ y_0 & y_1 & y_2 \\ z_0 & z_1 & z_2 \end{bmatrix}$$ where ...
66 views

### Clustering problem involving multidepots and customers requiring commodities located exclusively in an specific depot

I'm trying to solve a clustering problem that's similiar to a VRP Pickup and Delivery problem with multiple depots and customers. Each customer demands a commodity that is exclusively found on one ...
70 views

### Strange Result from GurobiPy

I am trying to understand why GurobiPy gives me a strange result for a simple linear programming model coded as below? Why is the optimality gap is 0%? Please let me know if you spot any errors in the ...
84 views

### Proving convexity for a function with summation and integer variable

I would like to show that the function $f$ is convex in $\rho\in [0,1)$ under $s\in \mathbb{Z}^+$. When I use Sympy packages of Python to find $\displaystyle\frac{\partial^2 f(\rho)}{d\rho^2}$. I get ...