Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark mode
Gurobi Optimizer Reference Manual
Light LogoDark Logo

Concepts

Features

Reference

Gurobi
Back to top

GRBConstr#

classGRBConstr#

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.

charget(GRB_CharAttrattr)#
doubleget(GRB_DoubleAttrattr)#
intget(GRB_IntAttrattr)#
stringget(GRB_StringAttrattr)#

Query the value of an attribute.

Parameters:

attr – The attribute being queried.

Returns:

The current value of the requested attribute.

intindex()#

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.

Returns:

-2: removed, -1: not in model, otherwise: index of theconstraint in the model

boolsameAs(GRBConstrconstr2)#

Check whether two constraint objects refer to the same constraint.

Parameters:

constr2 – The other constraint.

Returns:

Boolean result indicates whether the two constraint objectsrefer to the same model constraint.

voidset(GRB_CharAttrattr,charnewvalue)#
voidset(GRB_DoubleAttrattr,doublenewvalue)#
voidset(GRB_IntAttrattr,intnewvalue)#
voidset(GRB_StringAttrattr,conststring&newvalue)#

Set the value of an attribute.

Parameters:
  • attr – The attribute being modified.

  • newvalue – The desired new value of the attribute.

Help and Feedback

On this page

[8]ページ先頭

©2009-2025 Movatter.jp