Skip to main content

Questions tagged [gurobi]

Questions related to the commercial solver Gurobi Optimizer.

Filter by
Sorted by
Tagged with
29 votes
4 answers
15k 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 ...
Skander H.'s user avatar
  • 2,139
25 votes
3 answers
10k 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. ...
Skander H.'s user avatar
  • 2,139
22 votes
2 answers
7k 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 pipeline ...
Palaniappan Chellappan's user avatar
17 votes
5 answers
763 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 ...
Abhishiekh Ramesh's user avatar
16 votes
1 answer
1k 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 ...
dxb's user avatar
  • 1,799
14 votes
4 answers
978 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 ...
Yihe Zhuo's user avatar
  • 141
14 votes
3 answers
5k 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 ...
YukiJ's user avatar
  • 2,023
14 votes
4 answers
2k 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....
Mostafa's user avatar
  • 2,104
13 votes
2 answers
561 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-...
Colin M's user avatar
  • 133
12 votes
4 answers
4k 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 ...
Skander H.'s user avatar
  • 2,139
12 votes
3 answers
4k 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 (...
Makis Karasavvidis's user avatar
12 votes
2 answers
787 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 ...
Michiel uit het Broek's user avatar
11 votes
2 answers
898 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 ...
Rolf van Lieshout's user avatar
10 votes
2 answers
827 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. ...
aurelije's user avatar
  • 203
10 votes
1 answer
2k views

No "not equals" constraint in Gurobi

I'm using Gurobi and trying to set a constraint that two variables A, B are not equal ...
pigsun's user avatar
  • 145
10 votes
2 answers
2k 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 ...
Georgios's user avatar
  • 1,193
10 votes
1 answer
356 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 ...
Connor's user avatar
  • 431
10 votes
1 answer
381 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 ...
seimetz's user avatar
  • 513
10 votes
1 answer
170 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. ...
user22363's user avatar
  • 281
9 votes
2 answers
570 views

Dealing with Symmetry. Commercial solver defaults vs manual implementations

Since the modeler has domain/business knowledge of the problem being solved, is it possible to manually implement Isomorphism Pruning or Orbital branching and beat the default methods implemented by ...
user3711946's user avatar
9 votes
2 answers
1k views

Gurobi finishes with 'infeasible' although optimal solution exists

I am using Gurobi (in Python through gurobipy) to solve an IP on tournament graphs. I am searching for a non-zero minimal integer weighting such that for every vertex the sum of weights put on the ...
Legsleg's user avatar
  • 153
9 votes
3 answers
313 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 ...
rasul's user avatar
  • 2,150
9 votes
2 answers
2k 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 ...
Noah M's user avatar
  • 131
9 votes
2 answers
815 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 ...
SantiagoAm16's user avatar
9 votes
0 answers
201 views

Ill-conditioned LP in Benders decomposition

I have implemented a Benders decomposition for a constrained network flow but the LP solver (Gurobi) warns me of the ill-conditioning of the subproblem dual LP. As you can see below, the coefficients ...
Mauricio Zambon's user avatar
8 votes
2 answers
405 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 ...
YukiJ's user avatar
  • 2,023
8 votes
1 answer
650 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: ...
vy32's user avatar
  • 183
8 votes
1 answer
865 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-...
D.W.'s user avatar
  • 230
8 votes
1 answer
575 views

Using the values of variable in the objective function before optimizing

I am facing a problem to multiply a term in objective function. My objective function is : \begin{equation} \min \sum_{t=1}^\top p_{t} \cdot (1+r) \cdot y_{t} \end{equation} where $p$ is the ...
salidi's user avatar
  • 99
8 votes
1 answer
382 views

Translate LP format to Numpy matrices

We have a large-scale optimization problem (~10K vars and ~10K constraints) in the form of LP format file (generated using Cplex ...
pqrz's user avatar
  • 470
8 votes
1 answer
342 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 ...
tcokyasar's user avatar
  • 1,249
8 votes
1 answer
439 views

Why is Gurobi output in Pyomo returning floating-point values rather than optimal integer solution?

I am hoping someone will be able to point me in the direction of why I am experiencing floating-point outputs rather than simply model.X = [15,15] and model.Z = [15,5] as solutions to this model? Note ...
Jwem93's user avatar
  • 333
8 votes
2 answers
4k 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 ...
Jacob Myer's user avatar
8 votes
2 answers
3k 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 ...
Mehdi's user avatar
  • 683
8 votes
1 answer
775 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 ...
Connor's user avatar
  • 431
8 votes
1 answer
178 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 ...
user22363's user avatar
  • 281
7 votes
4 answers
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 ...
Georgios's user avatar
  • 1,193
7 votes
3 answers
502 views

Profit Maximization LP and Incentives Scenarios

I wrote a profit maximization LP with inventory, component usage, production, and machine hours constraints. When I optimize the model, it solves as expected. When applied towards a business case, ...
TroyE219's user avatar
  • 105
7 votes
1 answer
1k views

Problem is infeasible with Gurobi, feasible with cbc (but can't access objective value)

I am solving a MILP with cbc and gurobi (via pyomo). Gurobi states that the model is infeasible. As to cbc the solver status states that a feasible and optimal solution is found, but then it fails to ...
Meth's user avatar
  • 424
7 votes
1 answer
252 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 ...
David M.'s user avatar
  • 2,107
7 votes
1 answer
470 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 ...
Connor's user avatar
  • 431
7 votes
0 answers
879 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 ...
Jacob Myer's user avatar
6 votes
3 answers
947 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/...
Neal Young's user avatar
6 votes
1 answer
3k views

What exactly is the optimality-gap or what does it say in integer linear programming?

I am working since a few months with gurobi and did figure out, that the gap says how far a feasible solutions is away from the optimal solution. However, what does say it exactly? The gurobi docs ...
Mike's user avatar
  • 147
6 votes
1 answer
303 views

Gurobi searches all nodes despite variable initialization

We are trying to solve a large-scale MIQCQP (18K decision variables) problem via Gurobipy (v9.0.3). Gurobi is able to solve this problem in ~13 mins despite whether or not we initialize the decision ...
pqrz's user avatar
  • 470
6 votes
2 answers
409 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} \...
Mr.Robot's user avatar
  • 171
6 votes
1 answer
569 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 ...
Michael Trick's user avatar
6 votes
1 answer
311 views

Compute Scaling factor(s) for linear constraint ($A@x<b$)

We optimize large-scale optimization problems with tens of thousands of variables and constraints with Cvxpy + Commercial solvers (e.g. Gurobi, Mosek). The coefficient range easily exceeds the ...
pqrz's user avatar
  • 470
6 votes
1 answer
299 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: ...
lazar's user avatar
  • 73
6 votes
1 answer
666 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). ...
ctyler9's user avatar
  • 63

1
2 3 4 5 6