8.5.3. MDOVar¶
-
class MDOVar¶
Represent a decision variable in MindOpt application.
Methods
Retrieve a variable-owned int attribute value by its name
Retrieve a variable-owned char attribute value by its name
Retrieve a variable-owned double attribute value by its name
Retrieve a variable-owned string attribute value by its name
Retrieve the index of this variable
Test if this variable is the same as another
Set the value of a variable-owned int attribute
Set the value of a variable-owned char attribute
Set the value of a variable-owned double attribute
Set the value of a variable-owned string attribute
-
int get(MDO_IntAttr attr)¶
Retrieve a variable-owned int attribute value by its name.
- Parameters
MDO_IntAttr attr – The attribute name.
- Returns
The attribute value.
-
char get(MDO_CharAttr attr)¶
Retrieve a variable-owned char attribute value by its name.
- Parameters
MDO_CharAttr attr – The attribute name.
- Returns
The attribute value.
-
double get(MDO_DoubleAttr attr)¶
Retrieve a variable-owned double attribute value by its name.
- Parameters
MDO_DoubleAttr attr – The attribute name.
- Returns
The attribute value.
-
std::string get(MDO_StringAttr attr)¶
Retrieve a variable-owned string attribute value by its name.
- Parameters
MDO_StringAttr attr – The attribute name.
- Returns
The attribute value.
-
int index()¶
Retrieve the index of this variable.
- Returns
The index of this variable.
-
bool sameAs(MDOVar v2)¶
Test if this variable is the same as another.
- Parameters
MDOVar v2 – The variable to be compared.
- Returns
True if these two are the same
-
void set(MDO_IntAttr attr, int value)¶
Set the value of a variable-owned int attribute.
- Parameters
MDO_IntAttr attr – The attribute name.
int value – The new value to be set.
-
void set(MDO_CharAttr attr, char value)¶
Set the value of a variable-owned char attribute.
- Parameters
MDO_CharAttr attr – The attribute name.
char value – The new value to be set.
-
void set(MDO_DoubleAttr attr, double value)¶
Set the value of a variable-owned double attribute.
- Parameters
MDO_DoubleAttr attr – The attribute name.
double value – The new value to be set.
-
void set(MDO_StringAttr attr, const std::string &value)¶
Set the value of a variable-owned string attribute.
- Parameters
MDO_StringAttr attr – The attribute name.
const std::string& value – The new value to be set.
-
int get(MDO_IntAttr attr)¶