![]() |
MAiNGO
|
Class for representing an optimization variable specified by the user. More...
#include <babOptVar.h>
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, except in case of a binary variable. 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, except in case of a binary variable. 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, except in case of a binary variable. 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, except in case of a binary variable. 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 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 () | |
Default constructor The variable bounds are not defined. This function currently just throws an exception. 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_user_lower_bound () const |
Function for querying the lower variable bound as originally specified by the user. More... | |
double | get_user_upper_bound () const |
Function for querying the upper variable bound as originally specified by the user. 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... | |
bool | bounds_changed_from_user_input () const |
Function for querying whether the bounds have been modified (e.g., by rounding to integer values) compared to those specified by the user. More... | |
Private Member Functions | |
void | _round_and_check_discrete_bounds () |
sanity check of user-given bounds on discrete variables More... | |
void | _infer_and_set_bounds_or_throw () |
Auxiliary function for determining bounds in case the user did not specify any. More... | |
Private Attributes | |
Internal variables for storing information on the OptimizationVariable | |
Bounds | _bounds |
const Bounds | _userSpecifiedBounds |
const enums::VT | _variableType |
const unsigned | _branchingPriority |
const std::string | _name |
bool | _feasible |
Friends | |
std::ostream & | operator<< (std::ostream &os, const OptimizationVariable &ov) |
operator << overloaded for Bounds for easier output More... | |
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
|
inline |
Constructor for the case all three optional parameters are used.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | variableType | is the Variable Type of this variable |
[in] | branchingPriority | is the Branching Priority of this variable |
[in] | nameIn | is the name of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | variableType | is the Variable Type of this variable |
[in] | branchingPriority | is the Branching Priority of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | variableType | is the Variable Type of this variable |
[in] | nameIn | is the name of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | branchingPriority | is the Branching Priority of this variable |
[in] | nameIn | is the name of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | variableType | is the Variable Type of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | branchingPriority | is the Branching Priority of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
[in] | nameIn | is the name of this variable |
|
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.
[in] | variableBoundsIn | is the Bounds object representing lower and upper bounds on the optimization variable |
|
inline |
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, except in case of a binary variable.
[in] | variableType | is the Variable Type of this variable |
[in] | branchingPriority | is the Branching Priority of this variable |
[in] | nameIn | is the name of this variable |
|
inline |
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, except in case of a binary variable.
[in] | variableType | is the Variable Type of this variable |
[in] | branchingPriority | is the Branching Priority of this variable |
|
inline |
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, except in case of a binary variable.
[in] | variableType | is the Variable Type of this variable |
[in] | nameIn | is the name of this variable |
|
inline |
Constructor for the case only a variable type is specified. The variable bounds are not defined. This function currently just throws an exception, except in case of a binary variable.
[in] | variableType | is the Variable Type of this variable |
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.
[in] | branchingPriority | is the Branching Priority of this variable |
[in] | nameIn | is the name of this variable |
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.
[in] | branchingPriority | is the Branching Priority of this variable |
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.
[in] | nameIn | is the name of this variable |
OptimizationVariable::OptimizationVariable | ( | ) |
Default constructor The variable bounds are not defined. This function currently just throws an exception.
|
private |
Auxiliary function for determining bounds in case the user did not specify any.
Attemps to infer bounds from other information (e.g., variable type). If this is possible, the inferred bounds are stored in the corresponding member variables. If not, an exception is thrown.
|
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.
|
inline |
Function for querying whether the bounds have been modified (e.g., by rounding to integer values) compared to those specified by the user.
|
inline |
Function for querying the branching priority.
|
inline |
Function for querying the lower variable bound.
|
inline |
Function for querying the midpoint of the variable range.
|
inline |
Function for querying the variable name.
|
inline |
Function for querying the upper variable bound.
|
inline |
Function for querying the lower variable bound as originally specified by the user.
|
inline |
Function for querying the upper variable bound as originally specified by the user.
|
inline |
Function for querying the variable type.
|
inline |
Function for querying whether the host set of the variable is non-empty.
|
friend |
operator << overloaded for Bounds for easier output
[out] | os | is the outstream to be written to |
[in] | ov | is an optimization variable to be written |
|
private |
bounds on the optimization variable (potentially altered from the user-specified through rounding in case of discrete variables)
|
private |
optional: whether this variable should be branched on (default: 1)
|
private |
flag indicating whether the variable has a non-empty host set (upper bound >= lower bound; contains integer/binary values where approriate)
|
private |
optional: name of the variable
|
private |
bounds on the optimization variable as specified by the user (i.e., before potential rounding in case of discrete variables)
|
private |
optional: type of variable (default: enums::VT_CONTINUOUS)