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 a GRBGenConstr constructor.

General constraint objects have a number of attributes, which can be queried with the GRBGenConstr.Get method. For example, the general constraint type can be queried by calling Get (GRB.IntAttr.GenConstrType). It can also be queried more directly using genconstr.GenConstrType where genconstr is a GRBGenConstr object.

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