Bound Constraints

Lower and upper bounds limit the components of the solution x.

If you know bounds on the location of an optimum, you can obtain faster and more reliable solutions by explicitly including these bounds in your problem formulation.

Give 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 -Inf as the bound; similarly, use Inf if 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 Infs.

  • If only the first m out of n components have bounds, then you need only supply a vector of length m containing bounds. However, this shortcut causes solvers to throw a warning.

For example, suppose your bounds are:

x3 ≥ 8
x2 ≤ 3.

Write the constraint vectors as

l = [-Inf; -Inf; 8]
u = [Inf; 3] (throws a warning) or u = [Inf; 3; Inf].

Tip

Use Inf or -Inf instead of a large, arbitrary bound to lower memory usage and increase solver speed. See Use Inf Instead of a Large, Arbitrary Bound.

You need not 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.

Related Topics