GRBGenConstr#

class GRBGenConstr#

Gurobi general constraint object. General constraints are always associated with a particular model. You create a general constraint object by adding a constraint to a model (using one of the GRBModel::addGenConstr* methods), rather than by using a GRBGenConstr constructor.

The methods on general constraint objects are used to get and set general 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 the GRBModel object (GRBModel::get).

The full list of attributes can be found in the Attributes section of this document. Examples of how to query and set attributes can also be found in this section.

double get(GRB_DoubleAttr attr)#

Query the value of a double-valued general constraint attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

int get(GRB_IntAttr attr)#

Query the value of an int-valued general constraint attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

string get(GRB_StringAttr attr)#

Query the value of a string-valued general constraint attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

void set(GRB_DoubleAttr attr, double newvalue)#

Set the value of a double-valued general constraint attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.

void set(GRB_IntAttr attr, int newvalue)#

Set the value of an int-valued general constraint attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.

void set(GRB_StringAttr attr, const string &newvalue)#

Set the value of a string-valued general constraint attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.