C++ Reference: class MPVariable

This documentation is automatically generated.

The class for variables of a Mathematical Programming (MP) model.
Method
basis_status

Return type: MPSolver::BasisStatus

Advanced usage: returns the basis status of the variable in the current solution (only available for continuous problems). @see MPSolver::BasisStatus.

index

Return type: int

Returns the index of the variable in the MPSolver::variables_.

integer

Return type: bool

Returns the integrality requirement of the variable.

lb

Return type: double

Returns the lower bound.

name

Return type: const std::string&

Returns the name of the variable.

reduced_cost

Return type: double

Advanced usage: returns the reduced cost of the variable in the current solution (only available for continuous problems).

SetBounds

Return type: void

Arguments: double lb, double ub

Sets both the lower and upper bounds.

SetInteger

Return type: void

Arguments: bool integer

Sets the integrality requirement of the variable.

SetLB

Return type: void

Arguments: double lb

Sets the lower bound.

SetUB

Return type: void

Arguments: double ub

Sets the upper bound.

solution_value

Return type: double

Returns the value of the variable in the current solution. If the variable is integer, then the value will always be an integer (the underlying solver handles floating-point values only, but this function automatically rounds it to the nearest integer; see: man 3 round).

ub

Return type: double

Returns the upper bound.

unrounded_solution_value

Return type: double

Advanced usage: unrounded solution value, i.e. it won't be rounded to the nearest integer even if the variable is integer.

Send feedback about...