by Martin Staadecker
Numerical solvers, such as Gurobi, are tools used to solve linear programs.
This document is a record of what I've learnt about using numerical solvers while working with Switch, Pyomo and Gurobi.
The best resource when working with Gurobi is Gurobi's reference manual.
A few especially useful pages are:
-
Gurobi's parameter list especially the
Method
parameter. -
Gurobi's guidelines for numerical issues (see
docs/Numerical Issues.md
).
To specify a Gurobi parameter use the following format:
switch solve --solver gurobi --solver-options-string "Parameter1=Value Parameter2=Value"
.
We recommend always using "method=2 BarHomogeneous=1 FeasibilityTol=1e-5 crossover=0"
as your base parameters (this is what switch solve --recommended
does).
There are two methods that exist when solving a linear program. The first is the Simplex Method and the second is the Barrier solve method also known as interior-point method (IPM).
-
The Simplex Method is more robust than IPM (it can find an optimal solution even with numerically challenging problems).
-
The Simplex Method uses only 1 thread while the Barrier method can leverage multiple threads.
-
The Barrier method is significantly faster for our model sizes.
-
Running
switch solve --recommended
selects the Barrier method. -
By default, when the Barrier method finishes it converts its solution to a simplex solution in what is called the crossover phase (see details). This crossover phase takes the most time and is not necessary. Therefore is gets disabled by the
--recommended
flag. -
The crossover phase is important if the barrier method produces a sub-optimal solution. In this case use
--recommended-robust
to enable the crossover.