Concepts
Features
Reference
Gurobi constraint object. Constraints are always associated with aparticular model. You create a constraint object by adding a constraintto a model (usingGRBModel::addConstr), rather than by usingaGRBConstr constructor.
The methods on constraint objects are used to get and set constraintattributes. For example, constraint right-hand sides can be queried bycallingget (GRB_DoubleAttr_RHS). Note that you canalso query attributes for a set of constraints at once. This is doneusing the attribute query method on theGRBModel object(GRBModel::get).
The full list of attributescan be found in theAttributes section of thisdocument. Examples of how to query and set attributes can also be foundinthis section.
Query the value of an attribute.
attr – The attribute being queried.
The current value of the requested attribute.
This method returns the current index, or order, of the constraint inthe underlying constraint matrix.
Note that the index of a constraint may change after subsequent modelmodifications.
-2: removed, -1: not in model, otherwise: index of theconstraint in the model
Check whether two constraint objects refer to the same constraint.
constr2 – The other constraint.
Boolean result indicates whether the two constraint objectsrefer to the same model constraint.
Set the value of an attribute.
attr – The attribute being modified.
newvalue – The desired new value of the attribute.
Help and Feedback