TempVar

class TempVar

Temporary variable class.

This class represents a variable which has not been built yet by a Model. It contains all the arguments needed to create a real variable as instantiated by the Var class. It is made of a lower and an upper bound, a type (see VarType), and a column (see Column).

Example 1:

model.add_var(0., 1., Binary, 2.);
// is the same as
model.add_var(TempVar(0., 1., Binary, 2.));

Subclassed by idol::VarVersion

Public Functions

TempVar() = default

Default constructor.

Creates a new temporary variable. The default lower and upper bounds are 0 and Inf and the type is Continuous.

inline TempVar(double t_lb, double t_ub, VarType t_type, Column &&t_column)

Constructor.

Creates a new temporary variable.

Parameters:
  • t_lb – The desired lower bound.

  • t_ub – The desired upper bound.

  • t_type – The desired variable type.

  • t_column – The desired column.

TempVar(TempVar &&t_src) = default

Copy constructor.

Parameters:

t_src – The object to copy.

TempVar(const TempVar &t_src) = default

Move constructor.

Parameters:

t_src – The object to move.

TempVar &operator=(TempVar &&t_src) = default

Copy-assignment operator.

Parameters:

t_src – The object to copy.

TempVar &operator=(const TempVar &t_src) = default

Move-assignment operator.

Parameters:

t_src – The object to move.

inline const Column &column() const

Returns the column of the temporary variable (see Column).

Returns:

The column of the temporary variable.

inline Column &column()

Returns the column of the temporary variable (see Column).

Returns:

The column of the temporary variable.

inline double lb() const

Returns the lower bound of the temporary variable.

Returns:

The lower bound of the temporary variable.

inline void set_lb(double t_lb)

Sets the lower bound of the temporary variable.

Parameters:

t_lb – The desired lower bound of the temporary variable.

inline double ub() const

Returns the upper bound of the temporary variable.

Returns:

The upper bound of the temporary variable.

inline void set_ub(double t_ub)

Sets the upper bound of the temporary variable.

Parameters:

t_ub – The desired upper bound of the temporary variable.

inline VarType type() const

Returns the type of the temporary variable.

Returns:

The type of the temporary variable.

inline void set_type(VarType t_type)

Sets the type of the temporary variable.

Parameters:

t_type – The desired type of the temporary variable.