Questions tagged [gurobi]

Questions related to the commercial solver Gurobi Optimizer.

Filter by
Sorted by
Tagged with
3
votes
1answer
45 views

A tricky Bi-Level Location Problem using VISUM

I'm writing my thesis on the optimal location of Air-Taxi Stations. I'm using PTV VISUM for the transport model where I'll inherit the Origin-Destination demand matrix. I come from transportation ...
3
votes
1answer
255 views

Gurobi: how to add a constraint to make there be only one non-integer value

line1 line2 line3 line4 A 2.3 0 3.1 0 B 0 4 2.2 0 C 1.1 0 0 4.6 Let's say after optimization with certain constraints, my model will generate an optimal production allocation table similar to ...
1
vote
0answers
45 views

How to use gurobi to plan production and minimize the times of changeovers

Suppose we have two lines: L1 and L2. Suppose we have 4 product types: A1, ...
0
votes
0answers
49 views

Lower bound very bad. How to improve?

I have the following MILP: \begin{alignat}{2} \nonumber \mbox{minimize } \quad & \phi = \sum_{i=1}^{m-1} \sum_{f=1}^{F} \sum_{\underset{\bar{f} \neq f}{\bar{f}=1}}^F \sum_{h \in H} \left( D_{f \...
1
vote
1answer
59 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. ...
2
votes
1answer
73 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: ...
1
vote
0answers
60 views

Multiple conditions in indicator constraint of Gurobi

I'm working on a vehicle routing problem, in which a vehicle need to pick up amounts of things in some nodes. I'm trying to solve it by Gurobi optimizer. Except for meeting the time windows of each ...
2
votes
1answer
106 views

Problem with vehicle routing problem in Gurobi Python

I have a vehicle routing problem solved by linear programming, but I'm confused about the constraints (see the model in figure 1). In the model, $u$ and $x$ are decision variables, and we set node $0$ ...
0
votes
1answer
120 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: ...
1
vote
1answer
116 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...
1
vote
1answer
37 views

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

The following error was encountered when using LinExpr in gurobi: ...
1
vote
2answers
165 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 ...
1
vote
0answers
69 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: ...
1
vote
3answers
243 views

Gurobi does not work any more in Pyomo after getting a new license

I have been using Pyomo with a free Academic license for Gurobi and so far it worked quite well. Now my license expired and I received a new license that is stored in the folder "C:/Gurobi/gurobi....
2
votes
1answer
108 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 ...
3
votes
0answers
58 views

Linearization of a quadratic model, what is the difference while using gurobi?

I have a quadratic model of parking $N$ cars in $S$ separate lanes as follows. Each car has an arrival time and a departure time. Departure follow the last in first out principle. The objective is to ...
2
votes
1answer
114 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 ...
1
vote
0answers
58 views

Binary variable with two criteria in Gurobi (Java)

I have the following problem in Gurobi (Java). I have a binary variable $b$ that is supposed to be $1$ or $0$ depending on my optimisation variable $x$. It should be true that $b = 1$ if $c_1 \le x \...
0
votes
0answers
86 views

Problems with a MILP

I need some advice, any hints will be appreciated. I have a MILP and I am using Gurobi to solve it. I have a feasible integer solution. When I use mipstart, after ...
2
votes
1answer
121 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: ...
1
vote
1answer
59 views

Integral of PWL-Constraint in Gurobi (Java)

In my optimization model, I use piecewise-linear constraints with the output of $y[m]$. The question or problem I have now is whether there is a way in Gurobi (Java) to form the integral for this PWL ...
3
votes
1answer
64 views

Non-Convex QCP model - Used Method in Gurobi

I have the following question: I have a non-convex QCP model. In the parameter description for method it says that "Only barrier is available for continuous QCP models". However, the dual ...
1
vote
1answer
93 views

Method (Algorithm) and Objective used in Gurobi Model

How can I find out which method or algorithm was used to solve my model? When I use GRB.IntParam.Method- to output the method, I get ...
1
vote
0answers
56 views

Quadratic optimization in Gurobi with constraint

I have a question of understanding in Gurobi: I have an objective function in which my optimization variable x is squared. I have solved this bsiher by a quadratic objective function with $x$, $x$. ...
3
votes
1answer
340 views

How to find out which constraint causes problems in Pyomo

I have a Pyomo model with many constraints and variables. When solving it with Gurobi, I get the message "Model is infeasible or unbounded". Now I would like to find out which constraints ...
2
votes
0answers
45 views

Gurobi c++: Getting constraint matrix

I'm trying to get the constraint matrix from a Gurobi model in C++. In Python, one can get this by simply calling a method that will populate a scipy object (see this post). However, in a C++ fashion, ...
2
votes
2answers
135 views

Trouble with optional nodes in a VRP model using Gurobi for python

I am currently working on a VRP problem where the vehicles are electric. This means that I have range restrictions, and charging stations as nodes which are optional to visit. In my model I have the ...
3
votes
1answer
167 views

Linearizing a quadratic function with more variables or not in Gurobi?

Suppose I want to set the price $0 \le p_t \le p_{max} $ and based on the price, demand is determined $D_t(p_t)=a-bp_t$. Inventory level at each time is denoted by $I_t$ and it is determined by $I_t= ...
1
vote
0answers
73 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 ...
0
votes
0answers
89 views

Mixed Integer Programming - Model Formulation for A Resource Allocation Problem

There are a number of orders, which needs to be shipped. For each order, there may be 1 to 3 route options. The problem here is to find out the best allocation (combination) of orders among these ...
4
votes
1answer
125 views

How to add a SOS1 equality constraint?

Most MIP solver's API have special methods to add SOS1-constraints of the form $$ \sum_{i \in I} c_i x_i \leq 1, \tag{1}$$ i.e. at most one of the binary variables $x_i, i \in I$ is allowed to take a ...
1
vote
1answer
98 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 ...
0
votes
1answer
120 views

How to write this constraint in Gurobi python?

I'm wondering how I can translate this math constraint to gurobi python. $$\forall a \in A, b \in B, x_{ab} \in \{0, 1\}$$ So far I have written: ...
3
votes
1answer
105 views

Gurobi uses 1 core on supercomputer node with 64 cores

I have installed Gurobi 9.1.1 on a supercomputer node with 64 Xeon processors. For the installation I used conda. I access this node via ssh. When running "htop" I see that the process uses ...
4
votes
1answer
176 views

how to implement an optimization function with polynomial in Gurobi (Java)

I have the following problem: I have an objective function with the optimization variable $x$, which looks simplified like this: $ZF = (a+b)*(x+1)$ Here $a$ is simply a constant value. However, behind ...
0
votes
0answers
41 views

Linear equation from pairs of values with conditions in Gurobi (Java)

How can I create a linear equation in Gurobi (Java) from values (x-y value pairs) that also has the following properties: $\forall x \leq 0 \Longrightarrow y = 0$ The linear line/equation should have ...
0
votes
1answer
151 views

if-else query depending on optimization variable in Gurobi (Java)

I am looking for the most elegant solution to the following problem: I have an if-else query that depends on my optimization variable $x_i$. If $a \leq b_i + x_i$, the parameter $c$ should take the ...
2
votes
3answers
91 views

Link a binary variable to continuous variable in Java Gurobi

I have the following problem: Depending on my continuous optimization variable $S_m$, I would like to introduce a binary variable $x_m$, which, depending on the value of $S_m$ (greater or less than 0) ...
10
votes
2answers
644 views

Do LP solvers convert LPs to standard form?

To solve a linear program (LP) using the simplex method one first needs to bring the LP to standard form. This requires replacing every equality constraint with two inequalities and replacing every ...
5
votes
1answer
190 views

What underlies intlinprog in MATLAB?

When a paper says they used the intlinprog in MATLAB to solve an integer program, what system actually does the solving? I have seen documentation about Gurobi and MATLAB: does Gurobi always provide ...
2
votes
1answer
316 views

Pyomo can't find Gurobi solver

I have a pyomo model that I can solve using the GLPK solver by just using the code: ...
1
vote
1answer
90 views

Python Gurobipy Maximum Flow: How to model "source" and "sink" in constraints

I am attempting to capture the nature of a "source" node as well as a "sink" node where the net flow for each node aside from the source and sink is zero. Here is my code so far: <...
2
votes
1answer
90 views

Fixing the amount of variable in Gurobi - Python as a parameter for another model

I have solved a very simple mathematical model ( 2 variables) using Gurobi in Python and now I want to fix the amount of the variable in another model and solve it, for example, consider the variable $...
2
votes
1answer
86 views

Formulating "more complicated" objectives in Python Gurobi

I am currently learning how to use Gurobi for Python using their official tutorial found here. In this example, they appear to formulate the objective by simply specifying a cost dictionary to the <...
3
votes
2answers
159 views

How to validate a Gurobi academic license remotely via ssh SOCKS proxy?

How do I validate my Gurobi academic license remotely, that is, from a computer that is not on my university network? Official instructions for Gurobi 9.1 are here: https://www.gurobi.com/...
2
votes
0answers
73 views

Find multiple solutions in Pyomo with Gurobi

I am fairly new to Pyomo and Gurobi. I'd like to find 20 sets of different solutions that meet the following constraints. ...
2
votes
0answers
57 views

CPU time on Linux with Gurobi

I am solving a MILP model in C++ using Gurobi 10.1. I retrieve the CPU time of my C++ program under Linux via the following commands: ...
1
vote
1answer
94 views

Problem with setting up gurobi with OR-tools

I am trying to setup Gurobi with Google OR-Tools with the function pywraplp.Solver.CreateSolver("GUROBI"). The function returns None, which could occur if ...
5
votes
2answers
147 views

Directly calling gurobipy API causes substantially longer runtime than calling cvxpy

Background I am trying to implement the reranking algorithm proposed in the paper (Eqn 3). The algorithm is cast into an integer linear program which is trying to find permutation matrix $\mathbf{X} \...