GRBGenConstr#
- GRBGenConstr#
Gurobi general constraint object. General constraints are always associated with a particular model. You create a general constraint object by adding a general constraint to a model (using one of the
GRBModel.addGenConstr*
methods), rather than by using aGRBGenConstr
constructor.The methods on general constraint objects are used to get and set constraint attributes. For example, general constraint types can be queried by calling
get
(GRB.IntAttr.GenConstrType
). Note, however, that it is generally more efficient to query attributes for a set of constraints at once. This is done using the attribute query method on theGRBModel
object (GRBModel.get
).- double get(GRB.DoubleAttr attr)#
Query the value of a double-valued general constraint attribute.
- Arguments:
attr – The attribute being queried.
- Return value:
The current value of the requested attribute.
- int get(GRB.IntAttr attr)#
Query the value of an int-valued general constraint attribute.
- Arguments:
attr – The attribute being queried.
- Return value:
The current value of the requested attribute.
- String get(GRB.StringAttr attr)#
Query the value of a string-valued general constraint attribute.
- Arguments:
attr – The attribute being queried.
- Return value:
The current value of the requested attribute.
- void set(GRB.DoubleAttr attr, double newval)#
Set the value of a double-valued general constraint attribute.
- Arguments:
attr – The attribute being modified.
newval – The desired new value of the attribute.
- void set(GRB.IntAttr attr, int newval)#
Set the value of an int-valued general constraint attribute.
- Arguments:
attr – The attribute being modified.
newval – The desired new value of the attribute.
- void set(GRB.StringAttr attr, String newval)#
Set the value of a string-valued general constraint attribute.
- Arguments:
attr – The attribute being modified.
newval – The desired new value of the attribute.