Try our new documentation site (beta).

Filter Content By
Version

Each of the functions described below adds a new general constraint to a model.

Mathematical programming has traditionally defined a set of fundamental constraint types: variable bound constraints, linear constraints, quadratic constraints, integrality constraints, and SOS constraints. These are typically treated directly by the underlying solver (although not always), and are fundamental to the overall algorithm.

Gurobi accepts a number of additional constraint types, which we collectively refer to as general constraints. These are typically not treated directly by the solver. Rather, they are transformed by presolve into mathematically equivalent sets of constraints (and variables), chosen from among the fundamental types listed above. These general constraints are provided as a convenience to users. If such constraints appear in your model, but if you prefer to reformulate them yourself using fundamental constraint types instead, you can certainly do so. However, note that Gurobi can sometimes exploit information contained in the other constraints in the model to build a more efficient formulation than what you might create.

The additional constraint types that fall under this general constraint umbrella are:

• MAX (GRBaddgenconstrMax): set a decision variable equal to the maximum value from among a set of decision variables
• MIN (GRBaddgenconstrMin): set a decision variable equal to the minimum value from among a set of decision variables
• ABS (GRBaddgenconstrAbs): set a decision variable equal to the absolute value of some other decision variable
• AND (GRBaddgenconstrAnd): set a binary variable equal to one if and only if all of a set of binary decision variables are equal to one
• OR (GRBaddgenconstrOr): set a binary variable equal to one if and only if at least one variable out of a set of binary decision variables is equal to one
• INDICATOR (GRBaddgenconstrIndicator): whenever a given binary variable takes a certain value, then the given linear constraint must be satisfied

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

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.
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.