Try our new documentation site (beta).
Constraints
A constraint in Gurobi captures a restriction on the values that a set of variables may take. The simplest example is a linear constraint, which states that a linear expression on a set of variables take a value that is either less-than-or-equal, greater-than-or-equal, or equal to another linear expression. More complicated constraints are also supported, including quadratic constraints (e.g., ), logical constraints (e.g., logical AND on binary variables, if-then, etc.), and a few non-linear functions (e.g., ).
We now consider a few more details about linear, SOS, quadratic (both convex and non-convex), and general constraints. General constraints are the catch-all we use for the constraint types that don't fit in the other categories.
Recall that Gurobi works in finite-precision arithmetic, so constraints are only satisfied to tolerances. Tolerances can be tightened to reduce such violations, but there are limits to how small the violations can be — errors are inherent in floating-point arithmetic. This point will be reiterated in several places in this section.
Subsections