Concepts
Features
Reference
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.
Query the value of an attribute.
attr – The attribute being queried.
The current value of the requested attribute.
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.
-2: removed, -1: not in model, otherwise: index of the variablein the model
Check whether two variable objects refer to the same variable.
var2 – The other variable.
Boolean result indicates whether the two variable objects referto the same model variable.
Set the value of an attribute.
attr – The attribute being modified.
newvalue – The desired new value of the attribute.
Help and Feedback