Movatterモバイル変換


[0]ホーム

URL:


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

Concepts

Features

Reference

Gurobi
Back to top

GRBVar#

classGRBVar#

Gurobi variable object. Variables are always associated with aparticular model. You create a variable object by adding a variable to amodel (usingGRBModel::addVar), rather than by using aGRBVar constructor.

The methods on variable objects are used to get and set variableattributes. For example, solution information can be queried by callingget (GRB_DoubleAttr_X). Note that you can also queryattributes for a set of variables at once. This is done using theattribute 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 variable in theunderlying constraint matrix.

Note that the index of a variable may change after subsequent modelmodifications.

Returns:

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

boolsameAs(GRBVarvar2)#

Check whether two variable objects refer to the same variable.

Parameters:

var2 – The other variable.

Returns:

Boolean result indicates whether the two variable objects referto the same model variable.

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