Lower and upper bounds limit the components of the solution x.
If you know the bounds on the location of an optimum, you can obtain faster and more reliable solutions by explicitly including these bounds in your problem formulation.
Specify bounds as vectors with the same length as x, or as matrices with the same number of elements as x.
If a particular component has no lower bound, use
–Infas the bound; similarly, use
Infif a component has no upper bound.
If you have only bounds of one type (upper or lower), you do not need to write the other type. For example, if you have no upper bounds, you do not need to supply a vector of
If only the first m out of n components have bounds, then you only need to supply a vector of length m containing bounds. However, this shortcut causes solvers to issue a warning.
For example, suppose your bounds are:
x2 ≤ 3.
l = [–Inf; –Inf; 8],
u = [Inf;
3] (issues a warning) or
u = [Inf; 3;
To lower memory usage and increase solver speed, use
–Inf instead of a large, arbitrary bound. For more
information, see Use Inf Instead of a Large, Arbitrary Bound.
You do not have to give gradients for bound constraints; solvers calculate them automatically. Bounds do not affect Hessians.
For a more complex example of bounds, see Set Up a Linear Program, Solver-Based.