MAiNGO
babBase::OptimizationVariable Class Reference

Class for representing an optimization variable specified by the user. More...

#include <babOptVar.h>

Classes

struct  ChangedBounds
 Auxiliary struct for storing changed bounds of an optimization variable. More...
 

Public Member Functions

 OptimizationVariable (const Bounds &variableBoundsIn, const enums::VT variableType, const unsigned branchingPriority, const std::string nameIn)
 Constructor for the case all three optional parameters are used. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const enums::VT variableType, const unsigned branchingPriority)
 Constructor for the case only a variable type and a branching priority is specified in addition to the bounds. The variable name is empty. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const enums::VT variableType, const std::string nameIn)
 Constructor for the case only a variable type and a name is specified in addition to the bounds. The variable is used for branching. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const unsigned branchingPriority, const std::string nameIn)
 Constructor for the case only a branching priority and a name is specified in addition to the bounds. The variable is assumed to be continuous. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const enums::VT variableType)
 Constructor for the case only a variable type is specified in addition to the bounds. The variable is used for branching, and the name is empty. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const unsigned branchingPriority)
 Constructor for the case only a branching priority is specified in addition to the bounds. The variable is thus assumed to be continuous, and the name is empty. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn, const std::string nameIn)
 Constructor for the case only a name is specified in addition to the bounds. The variable is thus assumed to be continuous, and it is used for branching. More...
 
 OptimizationVariable (const Bounds &variableBoundsIn)
 Minimal constructor requiring only the required information. The variable is thus assumed to be continuous, it is used for branching, and the name is empty. More...
 
 OptimizationVariable (const enums::VT variableType, const unsigned branchingPriority, const std::string nameIn)
 Constructor for the case only a variable type, branching priority and a variable name are specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const enums::VT variableType, const unsigned branchingPriority)
 Constructor for the case only a variable type and branching priority are specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const enums::VT variableType, const std::string nameIn)
 Constructor for the case only a variable type and a variable name are specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const unsigned branchingPriority, const std::string nameIn)
 Constructor for the case only branching priority and a variable name arespecified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const enums::VT variableType)
 Constructor for the case only a variable type is specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const unsigned branchingPriority)
 Constructor for the case only a branching priority is specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const std::string nameIn)
 Constructor for the case only a variable name is specified. The variable bounds are not defined. This function currently just throws an exception. More...
 
 OptimizationVariable (const OptimizationVariable &variableIn)
 Copy constructor. More...
 
double get_lower_bound () const
 Function for querying the lower variable bound. More...
 
double get_upper_bound () const
 Function for querying the upper variable bound. More...
 
double get_mid () const
 Function for querying the midpoint of the variable range. More...
 
std::string get_name () const
 Function for querying the variable name. More...
 
enums::VT get_variable_type () const
 Function for querying the variable type. More...
 
unsigned get_branching_priority () const
 Function for querying the branching priority. More...
 
bool has_nonempty_host_set () const
 Function for querying whether the host set of the variable is non-empty. More...
 

Public Attributes

struct babBase::OptimizationVariable::ChangedBounds changedBounds
 

Private Member Functions

OptimizationVariableoperator= (const OptimizationVariable &)
 
void _check_discrete_bounds ()
 sanity check of user-given bounds on discrete variables More...
 

Private Attributes

Internal variables for storing information on the OptimizationVariable
double _lowerBound
 
double _upperBound
 
const enums::VT _variableType
 
const unsigned _branchingPriority
 
const std::string _name
 
bool _feasible
 

Friends

std::ostream & operator<< (std::ostream &os, OptimizationVariable const &ov)
 operator << overloaded for Bounds for easier output More...
 

Detailed Description

Class for representing an optimization variable specified by the user.

An optimization variable is characterized by an upper and lower bound, a variable type (enums::VT, optional), a branching priority (BP, optional), and a name (optional), all of which are private members. Once instantiated, it cannot be modified. Each optimization variable also contains a flag (_feasible) that indicates if the bounds are consistent (lower bound <= upper bound) and in case of integer variables, whether the interval contains an integer value

Constructor & Destructor Documentation

◆ OptimizationVariable() [1/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const enums::VT  variableType,
const unsigned  branchingPriority,
const std::string  nameIn 
)
inline

Constructor for the case all three optional parameters are used.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]variableTypeis the Variable Type of this variable
[in]branchingPriorityis the Branching Priority of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [2/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const enums::VT  variableType,
const unsigned  branchingPriority 
)
inline

Constructor for the case only a variable type and a branching priority is specified in addition to the bounds. The variable name is empty.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]variableTypeis the Variable Type of this variable
[in]branchingPriorityis the Branching Priority of this variable

◆ OptimizationVariable() [3/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const enums::VT  variableType,
const std::string  nameIn 
)
inline

Constructor for the case only a variable type and a name is specified in addition to the bounds. The variable is used for branching.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]variableTypeis the Variable Type of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [4/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const unsigned  branchingPriority,
const std::string  nameIn 
)
inline

Constructor for the case only a branching priority and a name is specified in addition to the bounds. The variable is assumed to be continuous.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]branchingPriorityis the Branching Priority of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [5/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const enums::VT  variableType 
)
inline

Constructor for the case only a variable type is specified in addition to the bounds. The variable is used for branching, and the name is empty.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]variableTypeis the Variable Type of this variable

◆ OptimizationVariable() [6/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const unsigned  branchingPriority 
)
inline

Constructor for the case only a branching priority is specified in addition to the bounds. The variable is thus assumed to be continuous, and the name is empty.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]branchingPriorityis the Branching Priority of this variable

◆ OptimizationVariable() [7/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn,
const std::string  nameIn 
)
inline

Constructor for the case only a name is specified in addition to the bounds. The variable is thus assumed to be continuous, and it is used for branching.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [8/16]

babBase::OptimizationVariable::OptimizationVariable ( const Bounds variableBoundsIn)
inline

Minimal constructor requiring only the required information. The variable is thus assumed to be continuous, it is used for branching, and the name is empty.

Parameters
[in]variableBoundsInis the Bounds object representing lower and upper bounds on the optimization variable

◆ OptimizationVariable() [9/16]

OptimizationVariable::OptimizationVariable ( const enums::VT  variableType,
const unsigned  branchingPriority,
const std::string  nameIn 
)

Constructor for the case only a variable type, branching priority and a variable name are specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]variableTypeis the Variable Type of this variable
[in]branchingPriorityis the Branching Priority of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [10/16]

OptimizationVariable::OptimizationVariable ( const enums::VT  variableType,
const unsigned  branchingPriority 
)

Constructor for the case only a variable type and branching priority are specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]variableTypeis the Variable Type of this variable
[in]branchingPriorityis the Branching Priority of this variable

◆ OptimizationVariable() [11/16]

OptimizationVariable::OptimizationVariable ( const enums::VT  variableType,
const std::string  nameIn 
)

Constructor for the case only a variable type and a variable name are specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]variableTypeis the Variable Type of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [12/16]

OptimizationVariable::OptimizationVariable ( const unsigned  branchingPriority,
const std::string  nameIn 
)

Constructor for the case only branching priority and a variable name arespecified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]branchingPriorityis the Branching Priority of this variable
[in]nameInis the name of this variable

◆ OptimizationVariable() [13/16]

OptimizationVariable::OptimizationVariable ( const enums::VT  variableType)

Constructor for the case only a variable type is specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]variableTypeis the Variable Type of this variable

◆ OptimizationVariable() [14/16]

OptimizationVariable::OptimizationVariable ( const unsigned  branchingPriority)

Constructor for the case only a branching priority is specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]branchingPriorityis the Branching Priority of this variable

◆ OptimizationVariable() [15/16]

OptimizationVariable::OptimizationVariable ( const std::string  nameIn)

Constructor for the case only a variable name is specified. The variable bounds are not defined. This function currently just throws an exception.

Parameters
[in]nameInis the name of this variable

◆ OptimizationVariable() [16/16]

babBase::OptimizationVariable::OptimizationVariable ( const OptimizationVariable variableIn)
inline

Copy constructor.

Parameters
[in]variableInis the optimization variable to be copied

Member Function Documentation

◆ _check_discrete_bounds()

void OptimizationVariable::_check_discrete_bounds ( )
private

sanity check of user-given bounds on discrete variables

Rounds non-discrete bounds to discrete values and updates the private member _feasible depending on whether discrete ub < discrete lb.

◆ get_branching_priority()

unsigned babBase::OptimizationVariable::get_branching_priority ( ) const
inline

Function for querying the branching priority.

◆ get_lower_bound()

double babBase::OptimizationVariable::get_lower_bound ( ) const
inline

Function for querying the lower variable bound.

◆ get_mid()

double babBase::OptimizationVariable::get_mid ( ) const
inline

Function for querying the midpoint of the variable range.

◆ get_name()

std::string babBase::OptimizationVariable::get_name ( ) const
inline

Function for querying the variable name.

◆ get_upper_bound()

double babBase::OptimizationVariable::get_upper_bound ( ) const
inline

Function for querying the upper variable bound.

◆ get_variable_type()

enums::VT babBase::OptimizationVariable::get_variable_type ( ) const
inline

Function for querying the variable type.

◆ has_nonempty_host_set()

bool babBase::OptimizationVariable::has_nonempty_host_set ( ) const
inline

Function for querying whether the host set of the variable is non-empty.

◆ operator=()

OptimizationVariable& babBase::OptimizationVariable::operator= ( const OptimizationVariable )
private

private declaration of copy assignment operator to prevent accidental use (standard copy would give a copy with const bounds etc)

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
OptimizationVariable const &  ov 
)
friend

operator << overloaded for Bounds for easier output

Parameters
[out]osis the outstream to be written to
[in]ovis an optimization variable to be written

Member Data Documentation

◆ _branchingPriority

const unsigned babBase::OptimizationVariable::_branchingPriority
private

optional: whether this variable should be branched on (default: 1)

◆ _feasible

bool babBase::OptimizationVariable::_feasible
private

flag indicating whether the variable has a non-empty host set (upper bound >= lower bound; contains integer/binary values where approriate)

◆ _lowerBound

double babBase::OptimizationVariable::_lowerBound
private

lower bound on the optimization variable

◆ _name

const std::string babBase::OptimizationVariable::_name
private

optional: name of the variable

◆ _upperBound

double babBase::OptimizationVariable::_upperBound
private

upper bound on the optimization variable

◆ _variableType

const enums::VT babBase::OptimizationVariable::_variableType
private

optional: type of variable (default: enums::VT_CONTINUOUS)

◆ changedBounds

struct babBase::OptimizationVariable::ChangedBounds babBase::OptimizationVariable::changedBounds

object holding information on possibly changed bound of the optimization variable


The documentation for this class was generated from the following files: