Variables
-
class Variable
Decision variables that appear in expressions.
Variables are used to define decision variables that are optimized.
Stream operator
Stream the variable to an output stream.
- param ostr:
output stream
- param arg:
variable
Public Functions
-
Variable()
Construct a continuous decision variable.
-
Variable &value(const Expression &value)
Set the initial variable value.
- Returns:
the variable object.
-
double value() const
- Returns:
the initial value of the variable
-
Expression value_expression() const
- Returns:
the expression defining the initial variable value
-
Variable &lower(const Expression &value)
Set the lower bound.
- Returns:
the variable object.
-
double lower() const
- Returns:
the lower bound
-
Expression lower_expression() const
- Returns:
the expression defining the variable lower bound
-
Variable &upper(const Expression &value)
Set the upper bound.
- Returns:
the variable object.
-
double upper() const
- Returns:
the upper bound
-
Expression upper_expression() const
- Returns:
the expression defining the variable upper bound
-
Variable &bounds(double lb, double ub)
Set the upper and lower bounds.
- Returns:
the variable object.
-
Variable &bounds(const Expression &lb, double ub)
Set the upper and lower bounds.
- Returns:
the variable object.
-
Variable &bounds(double lb, const Expression &ub)
Set the upper and lower bounds.
- Returns:
the variable object.
-
Variable &bounds(const Expression &lb, const Expression &ub)
Set the upper and lower bounds.
- Returns:
the variable object.
-
Variable &fixed(bool flag)
Set a flag indicating if the variable is fixed.
- Returns:
the variable object.
-
Variable &fix(double value)
Set the variable value and declare the variable fixed.
- Returns:
the variable object.
-
bool fixed() const
- Returns:
true
if the variable is fixed
-
std::string name() const
- Returns:
the value of the variable.
-
VariableTypes within() const
- Returns:
the variable type.
-
bool is_continuous() const
- Returns:
true
if the variable is continuous
-
bool is_binary() const
- Returns:
true
if the variable is binary
-
bool is_integer() const
- Returns:
true
if the variable is integer
-
size_t id() const
- Returns:
the unique integer variable ID
-
inline bool is_constant() const
- Returns:
false
because this is not a constant expression