8.5.3. MDOVar

class MDOVar

Represent a decision variable in MindOpt application.

Methods

get

Retrieve a variable-owned int attribute value by its name

get

Retrieve a variable-owned char attribute value by its name

get

Retrieve a variable-owned double attribute value by its name

get

Retrieve a variable-owned string attribute value by its name

index

Retrieve the index of this variable

sameAs

Test if this variable is the same as another

set

Set the value of a variable-owned int attribute

set

Set the value of a variable-owned char attribute

set

Set the value of a variable-owned double attribute

set

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.