Questions tagged [gurobi]

Questions related to the commercial solver Gurobi Optimizer.

Filter by
Sorted by
Tagged with
18
votes
3answers
4k views

What is the purpose of libraries like Pyomo and Google OR tools?

I'm new to the OR world, and trying to learn the various tools available. I originally thought that Pyomo and Google OR tools were open source alternatives to commercial solvers like Gurobi or CPLEX. ...
17
votes
5answers
440 views

Presolve is cutting down a lot of binary variables. Should I rethink my formulation?

I built my model on Python and am passing it to Gurobi to solve the problem. The presolve phase of Gurobi cuts down ~80% of the integer/binary variables and I am wondering if I should rethink my ...
17
votes
2answers
3k views

How does a warm start work in LP/MIP?

Can someone explain how warm starts/ MIP starts work? How do solvers like CPLEX/GUROBI use warm start with the Simplex algorithm? I am interested in understanding how the entire warm start ...
16
votes
4answers
2k 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 ...
16
votes
1answer
609 views

Are there any benefits to using Gurobi's built-in “blended” multi-objective functionality?

The newer versions of Gurobi include a couple of built-in functionalities for multi-objective optimization: blended objectives and hierarchical (lexicographically ordered) objectives. Suppose we ...
14
votes
4answers
511 views

Model conversion as fast as gurobipy and solved by open source solvers

Gurobipy is a fast solver and can convert a mathematical programming model to its underneath language very fast compared to some open source wrappers (e.g., PuLP, OR-tools, etc.). However, a ...
13
votes
3answers
892 views

When should I use dual Simplex over primal Simplex?

In Gurobi the user can change the method parameter in order to force Gurobi to use a particular method for solving MIPs. The user can, amongst others, choose ...
13
votes
3answers
952 views

How to model a mixed-integer linear programming formulation in Python using Gurobi?

I can remember that I spent some time in understanding how to formulate my first model. So I aimed at presenting a complete model here, wishing to save some time for students or researchers needing it....
13
votes
2answers
300 views

Querying attributes of LP relaxation at MIP-optimality in Gurobi

Is there a way to configure Gurobi to allow the LP relaxation associated with the optimal solution leaf of a MIP branch-and-bound tree to be queried for shadow prices & other general LP properties-...
12
votes
2answers
354 views

When does Gurobi add cuts from callback

A while ago I used Gurobi and I added user cuts from within a callback. However, I got the feeling that my user cuts were not directly added to the model. Is it right that Gurobi can decide to ...
10
votes
4answers
2k views

What do solvers like Gurobi and CPLEX do when they run into hard instances of MIP?

MIP is NP-Hard, so it is possible that an instance is very difficult and has multiple local minima that the search can get stuck in. With a Metaheuristic Algorithm, the stochastic and approximate ...
10
votes
3answers
674 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 (...
10
votes
2answers
801 views

Decision Variable Value from a Set (Gurobi)

Is there a way to set a decision variable to take values from a set? Example: decision variable $x \in \{0,50,100\}$ So this variable can only take one of these three values and not more. I have ...
10
votes
1answer
180 views

Specify the sense of a constraint in CPLEX

I am writing a small wrapper around Gurobi and Cplex so that the models I write are solver independent. I'm very familiar with Gurobi but I'm very new to Cplex and I'm having trouble replicating ...
10
votes
1answer
163 views

Lagrangian Relaxation bound greater than optimal solution

I am working on a Lagrangian relaxation for a minimization MIP. Everything seemed to be working fine before I started to run a batch of instances. Checking the log results for one of the instances ...
10
votes
1answer
107 views

Wild oscillation of dual infeasibility in Gurobi mixed-integer solver

As the question says, I am wondering what happens "behind the scene" when the Dual Infeasibility column of the Gurobi runtime log oscillates wildly, before Gurobi eventually quits with infeasibility. ...
9
votes
2answers
646 views

Modeling and solvers

I have just started to dive into OR world on my work. Currently we are using GAMS with Gurobi but some of us have strong programming background and would like to have more programmatic approach to OR. ...
9
votes
2answers
155 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 ...
9
votes
2answers
836 views

Is there a way to view added constraints in Gurobi (Python)?

I should note that I am very new to Gurobi so apologies if this is obvious. I am working on a project for a class to maximize profit on a theoretical flight network by deciding which routes to fly at ...
9
votes
2answers
177 views

Common structures in Gurobi - Python

I'm new to Gurobi in Python and I was wondering if someone knows how to code some common structures of linear constraints. I'm trying to understand how you'll code something like the following ...
9
votes
0answers
127 views

Ill-conditioned LP in Bender's decomposition

I have implemented a Bender's decomposition for a constrained network flow but the LP solver (Gurobi) warns me of the ill-conditioning of the slave dual LP. As you can see below, the coefficients seem ...
8
votes
4answers
2k views

Why is there not a feasible solution for a MIP?

Is there a way to see why a solver (OR-Tools, CPLEX, Gurobi) cannot find a feasible solution when solving a MIP? By that I mean, is there a possibility to show at which constraint and exact indices ...
8
votes
2answers
225 views

Does the API affect the time Gurobi requires to find an optimum?

When working with Gurobi, CPLEX and the like the user can choose between many different APIs, for example Python, C++, R, Java, Matlab or C. Some of these API are more efficient than others. For ...
8
votes
1answer
283 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: ...
8
votes
1answer
188 views

Can Gurobi or CPLEX handle nonlinearly constrained problems?

Though my title is quite general (please feel free to edit), indeed, I wonder if the following models can be solved in Gurobi or CPLEX. Model 2 is just an alternative one to Model 1. Although we ...
8
votes
2answers
2k views

How can I add this conditional constraint to my model in Python?

I am creating an optimization model with 2 sets of binary decision variables. The first, site, is regarding which of 380 cities to place manufacturing sites in, and ...
8
votes
2answers
1k views

Gurobi's “Out of memory” error without exhausting the RAM?

I wrote a branch-and-price algorithm in Python 2.7 which solves several small LP and MIP models by Gurobi 8.1 in each node. The algorithm runs fine at first, it produces both lower bound and upper ...
8
votes
1answer
250 views

Optimization software for ARM Architecture

Given that tomorrow Apple will likely announce the first ARM Macs (per bloomberg), I was wondering what the current status of ARM support in optimization software. For instance, does anyone know if ...
8
votes
1answer
135 views

Extract info from Gurobi binary variables during run-time

Actually the question below is not specific to Gurobi, but that's the tool I am using. Consider a scheduling problem where a 2D array of binary variables $Z(i,v)$ is defined, where $i$ is index of ...
7
votes
1answer
84 views

Gurobi: can you retrieve the dual solution from each node of the B&B tree using callbacks

When solving a MIP with Gurobi, one can use the cbGetNodeRel() function to extract the primal solution to the LP relaxation at each node in the branch and bound ...
7
votes
1answer
162 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-...
7
votes
1answer
157 views

Updating a relaxed model in Gurobi

If I obtain a relaxed version of my model using r = model.relax() then add variables and constraints to the original model, will the relaxed version automatically ...
7
votes
0answers
396 views

Having trouble with objective function in Python: “GurobiError: Variable not in model”. What else could I try?

I am trying to figure out how I can write this objective function into python using Gurobi. I have to minimize the sum of the product of three dictionary's values. The reason I am confused is that ...
6
votes
1answer
128 views

Gurobi stuck at start - 16GB RAM exhausted

I'm solving a large instance using Gurobi 7.0, 64-bit version on machine with 16GB of RAM. Gurobi is stuck at the start and all the memory is exhausted. Here is the output: ...
6
votes
1answer
210 views

Advanced Heuristics for MIP vehicle routing problem in PuLP

I am currently trying to speed up an MIP. An approach I was considering was to implement a cut callback heuristic with PuLP (one which rounds relaxed integer variables greater than .9 to 1). ...
6
votes
1answer
182 views

GUROBI Re-optimize a model

(For Linear Programming) I am aware of CPLEX's reoptimize methods. If I am not wrong, if you solve a problem and after that you add a new constraint, then you can call the reoptimize method for not to ...
5
votes
3answers
337 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, ...
5
votes
1answer
111 views

Guidelines for adding user cuts to models

Given that you have identified a new class of valid inequalities. What are some guidelines on when and how many and which of the violated user cuts you add to the model? I know that this involves a ...
4
votes
2answers
113 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} \...
4
votes
1answer
198 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
71 views

Inputting logical constraints into a binary programming model in Gurobi

I am very new to Gurobi and OR in general (I'm in my first class for it now), so apologies if this is a very obvious answer. For a project in that class, I am generating a flight schedule for a ...
3
votes
2answers
137 views

Using R for coding Matheuristic for Research Publication

Given that R possesses superior data pre-processing and post-processing packages, I am thinking of coding a matheuristic using R for publishing in an academic research journal. However, I am unable ...
3
votes
1answer
158 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}...
3
votes
2answers
141 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
111 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 ...
3
votes
2answers
139 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\...
3
votes
1answer
136 views

Gurobi C++: adding variables with vector

I am solving an LP by using GUROBI - C++ combo. Assume I have a variable $p \in \mathbb{R}^n$. I am adding this as a vector: ...
3
votes
1answer
120 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
73 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/...
3
votes
1answer
130 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 ...