8.9.12. MDOVar¶
- MDOVar¶
Represent a decision variable in MindOpt application
Methods
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
Set the value of the int attribute owned by a variable
Set the value of the char attribute owned by a variable
Set the value of the double attribute owned by a variable
Set the value of the String attribute owned by a variable
Convert the current decision variable to a string
- 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)¶
Set 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)¶
Set 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)¶
Set 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)¶
Set 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()¶
Convert the current decision variable to a string.
- Returns
The string format of the decision variable.