Hot answers tagged

50 votes
Accepted

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

Disclaimer: I am currently working for a commercial solver company (Gurobi) and have worked before on another commercial solver (IBM CPLEX). Hence, my opinion may be biased, but still I am trying to ...
user avatar
20 votes

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

No, the situation isn´t the same for OR libraries. There are several reasons for this, among them being Performance: The difference is relevant, with an emphasis on Mixed Integer Programming (linear ...
user avatar
  • 1,577
19 votes

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

Pyomo is an algebraic modeling language and allows users to easily represent optimization problems at a high-level (by defining variables, constraints, objective, etc.). Pyomo then provides interfaces ...
user avatar
19 votes

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

I think the short answer is: speed. Most optimization problems solved in the OR world are computationally intractable, they cannot be solved in reasonable time as the size of the data increases. A ...
user avatar
  • 10.2k
16 votes
Accepted

How does a warm start work in LP/MIP?

For the simplex algorithms, warmstarting a solver typically means installing a near-optimal basis and using that as a starting point instead of doing a crash or slack basis as a first step. This works ...
user avatar
16 votes

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

OR-Tools is a set of solver: A very popular Routing Library built on top of a traditional constraint programming solver An award winning ...
user avatar
16 votes

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

The term "local optimum" is a little misleading here. Assuming your MIP is linear (or at least convex), every local minimum is also a global minimum, so there is no such thing as "getting stuck in a ...
user avatar
14 votes

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

First of all, the log output of a solver should not change your mind about the formulation you use. Most of the times, one can not imagine how such geometric spaces look like and it is hard to guess ...
user avatar
14 votes
Accepted

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

Performing parallel operations deterministically often leads to some overhead and threads waiting or idling - this is the spin time. A non-deterministic or opportunistic parallel mode does not have ...
user avatar
  • 1,493
14 votes
Accepted

No "not equals" constraint in Gurobi

If you want $x_1\neq x_2$, you can linearize $|x_1-x_2|\ge \varepsilon$, where $\varepsilon$ is your tolerance. You can do this by introducing a boolean variable $y=1$ if and only if $x_1-x_2\ge \...
user avatar
  • 10.2k
13 votes
Accepted

Why is there not a feasible solution for a MIP?

Yes - such a question can be answered by looking at the irreducible inconsistent subsystem (IIS). From the Gurobi documentation: An IIS is a subset of the constraints and variable bounds with the ...
user avatar
  • 1,313
12 votes

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

You can use model.write("mymodel.lp") to generate an LP file (similarly for .mps and other common formats) that you can pass in ...
user avatar
  • 566
12 votes
Accepted

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

Here is the complete implementation for the above-mentioned model. ...
user avatar
  • 2,044
12 votes

Modeling and solvers

I can't address the specifics of Python, Pyomo, Gurobi or GAMS, but I can address the general question of using a modeling language (such as GAMS) versus building the model directly in a general ...
user avatar
  • 29.7k
12 votes
Accepted

Do LP solvers convert LPs to standard form?

No, state of the art LP solvers do not do that. They do bring the problem into a computational form that suits the algorithm used. Note that in the case of simplex algorithms, modern solvers use the ...
user avatar
11 votes

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

As pointed out by others here, in principle a branch-and-cut based solver can't get stuck, it can just continue until in the worst case it enumerated all integer solutions. Of course that might take ...
user avatar
11 votes
Accepted

Decision Variable Value from a Set (Gurobi)

I don't think directly, but one way to model that would be to: define a parameter as the vector of the possible values: $p = [0,50,100]$ define three binary decision variables that each correspond to ...
user avatar
  • 1,307
11 votes

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

Let $x_{p,\ell}$ be the continuous variables in your table. Introduce integer variables $y_{p,\ell}$ and binary variables $z_{p,\ell}$, and impose linear constraints \begin{align} -z_{p,\ell} \le x_{...
user avatar
  • 22.2k
10 votes

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

Complementing the other good answers, please note that presolve is concerned with problem input data and tries to eliminate variables using logical reductions. While a huge reduction in the number of ...
user avatar
  • 2,410
10 votes

When should I use dual Simplex over primal Simplex?

Dual simplex is the method of choice for resolving an LP if you have an optimal solution and you change the problem by modifying the feasible region. Ranging the RHS, adding cuts or branching in MIP, ...
user avatar
10 votes
Accepted

When does Gurobi add cuts from callback

Assuming you are using more than a single thread, then Gurobi performs all work you code in the callbacks with a single thread. All remaining threads process the branch and bound nodes (without doing ...
user avatar
10 votes

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

Gurobi and CPLEX use (very sophisticated) variants of the branch-and-bound algorithm. In Mixed Integer Programs, there can be both continuous and integer variables. It turns out that the integer ...
user avatar
10 votes

Settings for a faster solution of a MILP (GUROBI, python)

You could try changing the parameter mipfocus to 2 or 3 (https://www.gurobi.com/documentation/9.0/refman/mipfocus.html) in order to let Gurobi focus more on improving the bound or proving optimality. ...
user avatar
  • 3,477
10 votes

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

MILPs are NP-hard. People make a big deal about NP-hardness for a reason - in the worst case they are very, very hard to solve. There is a short, easy to understand exposition of this by @Johan ...
user avatar
10 votes

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

If I read the lp file and try solving with CPLEX: So I think your assumption is correct: the bug comes from CBC, as CPLEX and GUROBI both return infeasible. The CPLEX log also tells you which row is ...
user avatar
  • 10.2k
10 votes
Accepted

Dealing with Symmetry. Commercial solver defaults vs manual implementations

There might be automatic settings and tunings inside the solver that are not perfect and might choose not to use orbital branching for an instance although it might be beneficial. In that case the ...
user avatar
9 votes

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

If you do a lot of looping in Python to build your model, then model building is going to be slow. We have illustrated this for Pyomo (and the same undoubtedly holds for Pulp) in a notebook that ...
user avatar
  • 2,451
9 votes

Why is there not a feasible solution for a MIP?

There exist various reasons why a solver could not find the optimal solution. You must always check why a solver terminated. Typical reasons are: optimal solution was found termination criteria was ...
user avatar
9 votes

Settings for a faster solution of a MILP (GUROBI, python)

If you have a recent enough version of Gurobi, there is a tuning tool that tries to find better parameter sets than the default settings. For best results, run it for a while (at least overnight) and ...
user avatar
9 votes

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

(Full disclosure: I run a solver company) The state of the art Unlike ML, in the optimisation space commercial software is unfortunately on average superior to open-source alternatives. This does not ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible