Try our new documentation site (beta).

Improving ranges for variables and constraints

There are three common ways to improve ranges for objectives, constraints and variables:

  • Use problem-specific information to tighten bounds:

    Although presolve, and, in particular, bound strengthening, is quite good at deriving implied variables bounds, it may not have access to all of the information known to the modeler. Incorporating tighter bounds directly into the model can not only improve the numerical behavior, but it can also speed up the optimization process.

  • Choose the right units to express your variables and constraints:

    When defining your variables and constraints, it is important to choose units that are consistent with tolerances. To give an example, a constraint with a <span>$</span>10^{10}<span>$</span> right-hand side value is not going to work well with the default <span>$</span>10^{-6}<span>$</span> feasibility tolerance. By changing the units (e.g., replacing pounds with tons, or dollars with millions of dollars, or ...), it is often possible to significantly improve the numerics of the problems.

  • Disaggregate multiple objectives:

    A common source for very large range of objective coefficients is the practice of modeling hierarchical objectives as an aggregation of objective functions with large multipliers. For example, if the user wants to optimize a problem <span>$</span>P<span>$</span> with objective function <span>$</span>f_1(x)<span>$</span> and then, subject to <span>$</span>f_1(x)<span>$</span> being optimal, optimize <span>$</span>f_2(x)<span>$</span>, a common trick is to use as surrogate objective <span>$</span>\bar{f}(x) = M f_1(x) +
f_2(x)<span>$</span> where <span>$</span>M<span>$</span> is a large constant. When you combine a large <span>$</span>M<span>$</span> with a relatively tight dual feasibility tolerance, it becomes much harder for the solver to find solutions that achieve dual feasibility. We recommend that you either use as small a constant <span>$</span>M<span>$</span> as possible or reformulate your model using a hierarchical objective (which is made easier by our multi-objective optimization features).

These techniques are usually sufficient to eliminate the problems that arise from bad scaling.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization