GRBQConstr#

GRBQConstr#

Gurobi quadratic constraint object. Quadratic constraints are always associated with a particular model. You create a quadratic constraint object by adding a quadratic constraint to a model (using GRBModel.AddQConstr), rather than by using a GRBQConstr constructor.

The methods on quadratic constraint objects are used to get and set quadratic constraint attributes. For example, quadratic constraint right-hand sides can be queried by calling Get (GRB.DoubleAttr.QCRHS). It can also be queried more directly using qconstr.QCRHS where qconstr is a GRBQConstr object. 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.

char Get(GRB.CharAttr attr)#

Query the value of a char-valued quadratic constraint attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

double Get(GRB.DoubleAttr attr)#

Query the value of a double-valued quadratic 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 quadratic 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 quadratic constraint attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

void Set(GRB.CharAttr attr, char newvalue)#

Set the value of a char-valued quadratic constraint attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.

void Set(GRB.DoubleAttr attr, double newvalue)#

Set the value of a double-valued quadratic 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 quadratic 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 quadratic constraint attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.