8.5.11. MDOVar¶
- MDOVar¶
Represent a decision variable in MindOpt application
Methods
Create a decision variable in the model
Retrieve the int attribute value owned by a variable by name
Retrieve a char attribute value owned by a variable by name
Retrieve a double attribute value owned by a variable by name
Retrieve a String attribute value owned by a variable by name
Retrieve the index of this variable
Test whether this variable is the same as another variable
Sets the value of the int attribute owned by a variable
Sets the value of the char attribute owned by a variable
Sets the value of the double attribute owned by a variable
Sets the value of the String attribute owned by a variable
Converts the current decision variable to a string
- MDOVar(long model, int index)¶
Create a decision variable in the model
- Parameters
long model – The associated model
int index – The index of the new decision variable in the model.
- int get(MDO.IntAttr attr)¶
Retrieve the int attribute value owned by a variable by name
- Parameters
MDO.IntAttr attr – Attribute name
- Returns
Attribute value
- char get(MDO.CharAttr attr)¶
Retrieve a char attribute value owned by a variable by name
- Parameters
MDO.CharAttr attr – Attribute name
- Returns
Attribute value
- double get(MDO.DoubleAttr attr)¶
Retrieve a double attribute value owned by a variable by name
- Parameters
MDO.DoubleAttr attr – Attribute name
- Returns
Attribute value
- String get(MDO.StringAttr attr)¶
Retrieve a String attribute value owned by a variable by name
- Parameters
MDO.StringAttr attr – Attribute name
- Returns
Attribute value
- int index()¶
Retrieve the index of this variable
- Returns
Index of this variable
- bool sameAs(MDOVar v2)¶
Test whether this variable is the same as another variable
- Parameters
MDOVar v2 – Variables to compare
- Returns
True if the two are the same
- void set(MDO.IntAttr attr, int value)¶
Sets the value of the int attribute owned by a variable.
- Parameters
MDO.IntAttr attr – Attribute name
int value – The new value to be set.
- void set(MDO.CharAttr attr, char value)¶
Sets the value of the char attribute owned by a variable.
- Parameters
MDO.CharAttr attr – Attribute name
char value – The new value to be set.
- void set(MDO.DoubleAttr attr, double value)¶
Sets the value of the double attribute owned by a variable.
- Parameters
MDO.DoubleAttr attr – Attribute name
double value – The new value to be set.
- void set(MDO.StringAttr attr, String value)¶
Sets the value of the String attribute owned by a variable.
- Parameters
MDO.StringAttr attr – Attribute name
String value – The new value to be set.
- String toString()¶
Converts the current decision variable to a string.
- Returns
The string format of the decision variable.