Questions tagged [gurobi]

Questions related to the commercial solver Gurobi Optimizer.

Filter by
Sorted by
Tagged with
3
votes
0answers
42 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
64 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
31 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
75 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 ...
0
votes
0answers
32 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
50 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
46 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
87 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
55 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
186 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
41 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
107 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
161 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
67 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
77 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 ...
3
votes
1answer
99 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
74 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
94 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
92 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
153 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
40 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
131 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
83 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
630 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
177 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
159 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
51 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
81 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
82 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
1answer
84 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/...
1
vote
0answers
57 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
55 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
74 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 ...
4
votes
2answers
131 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} \...
2
votes
2answers
43 views

AMPL Gurobi Define Variables Bounds

I am trying to define both upper and lower bounds for a vector of variables in AMPL (solver Gurobi). However, after solving to optimal solution, the variables violate the bounds. The only way these ...
5
votes
3answers
462 views

Gurobi and CPLEX cannot exploit more than 32 cores of machine

I have some attempts to solve a scheduling problem using the Gurobi and doCPLEX API in python and .NET on Ubuntu-server installed on a hyper-computing cluster with 64 physical cores. Unfortunately, ...
8
votes
1answer
321 views

What does “Concurrent spin time” mean in the Gurobi log and what does choosing Method=3 do?

We are using Gurobi 9.0.2 to solve complex mixed integer linear programs for which we are attempting to maintain total unimodularity (TUM). In our log file we see things like this: ...
3
votes
1answer
138 views

Using log optimization function in Gurobi

I'm trying to use Gurobi to model an optimization max function whose objective function is $$f(x)=\frac{r^Tx}{x^TQx}.$$ Thus maximizing this function $f(x)$ is the same as maximizing $\log f(x)$ and I ...
9
votes
2answers
162 views

Objective Integrality Cuts

Consider a mixed integer linear program with an objective function that includes only integer variables. Objective integrality cuts are known as a class of valid inequalities that can be added to ...
3
votes
2answers
280 views

Calculated CPU time of C++ is different from actual time to solve MILP model via Gurobi

I am solving a MILP model in C++ using Gurobi 7.5.2. More specifically, I am determining the CPU time of my C++ program via the following commands: clock_t start_time; double elapsed_time; start_time=...
3
votes
2answers
184 views

How to get an extreme ray of an LP from Gurobi

I am working on a problem of form \begin{equation} \begin{array}{l @{\quad} l} \mathrm{max}_{x, u} & p^{\top} u \\ \text{st.} & A u + a x \leq 0 \\ & x \in \{0, 1\...
7
votes
1answer
212 views

No, Gurobi, I really do want this variable to be binary

When I mark a variable in a Gurobi MIP model as binary, sometimes Gurobi gives me a solution where that variable has a fractional value other than 0 or 1. How do I constraint a variable to be honest-...
18
votes
4answers
3k views

What are the advantages of commercial solvers like Gurobi or Xpress over open source solvers like COIN-OR or CVXPY?

I come from an ML background, and occasionally have to dive into the OR world. I am trying to figure out whether I need to purchase a commercial solver license for a certain problem set. In the ML ...
3
votes
1answer
145 views

Derive “true” shadow price for degenerated LPs using commercial solvers (e.g. Gurobi)

In linear programming for an optimal primal degenerate solution the values of the dual variables are in general not identical with the corresponding shadow prices. Several proposals on how to find the ...
3
votes
1answer
172 views

Issue in solving a large scale MIQP problem

I am solving a large scale MIQP optimisation problem at each step of a model predictive control problem. The problem description is as below. \begin{align} \min_{u} \quad (x_{k}&-x_\text{ref})^{T}...
1
vote
1answer
99 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: \begin{align}\max_w&\quad w^\top\Pi\\\text{s.t.}&\quad w^\top\Sigma w=\sigma^{\rm target}\\&...
3
votes
1answer
174 views

Why is the Lagrange Multiplier not equal the Shadow Price (Excel solver, Matlab linprog, Gurobi)?

I have a LP with equality and inequality constraints. When solving the LP with the excel-solver (GRG Nonlinear) the sensitivity report returns the lagrange multiplier for all constraints. When solving ...
2
votes
2answers
332 views

How can I identify the reason that makes a MILP model hard for solvers such as CPLEX?

I'm solving a MILP model whose native lower bound (via linear relaxation) is very poor. We could provide a lower bound by providing a given value (derived based on the problem itself). I know that ...
1
vote
0answers
82 views

Expansion heuristic using gurobi reduced cost / shadow price (LP)

Gurobi 9.0.0 // C++ // LP Let us assume the following problem with three nodes: (1)-----(2)-----(3) node (1) is producing ...
3
votes
2answers
167 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 ...