coin-Bcp
|
Abstract base class that defines members common to all types of variables. More...
#include <BCP_var.hpp>
Public Member Functions | |
Constructor and destructor | |
Note that there is no default constructor. There is no such thing as "default variable". | |
BCP_var (const BCP_var_t var_type, const double obj, const double lb, const double ub) | |
The constructor sets the internal index of the variable to zero and the other data members to the given arguments. More... | |
virtual | ~BCP_var () |
The destructor is virtual so that the appropriate destructor is invoked for every variable. More... | |
Query methods | |
virtual BCP_object_t | obj_type () const =0 |
Return the type of the variable. More... | |
BCP_var_t | var_type () const |
Return the integrality type of the variable. More... | |
double | obj () const |
Return the objective coefficient. More... | |
double | lb () const |
Return the lower bound. More... | |
double | ub () const |
Return the upper bound. More... | |
int | bcpind () const |
Return the internal index of the variable. More... | |
Query methods about the status of the variable | |
BCP_obj_status | status () const |
Return the status of the variable. More... | |
bool | dont_send_to_pool () const |
Return whether the variable should be sent to the Variable Pool process. More... | |
bool | is_fixed () const |
Return whether the variable is fixed or not. More... | |
bool | is_fixed_to_zero () const |
Return whether the variable is fixed to zero or not. More... | |
bool | is_non_removable () const |
Return whether the variable is marked NotRemovable. More... | |
bool | is_removable () const |
Return whether the variable is removable from the formulation at the time of the query. More... | |
bool | is_to_be_removed () const |
Return whether the variable must be removed from the formulation. More... | |
Modifying methods | |
void | test_inactive () |
Test (and set) whether the var is fixed (inactive) More... | |
void | set_var_type (const BCP_var_t type) |
Set the integrality type of the variable. More... | |
void | set_obj (const double obj) |
Set the objective coefficient. More... | |
void | set_lb (const double lb) |
Set the lower bound. More... | |
void | set_ub (const double ub) |
Set the upper bound. More... | |
void | set_lb_ub (const double lb, const double ub) |
Set both lower and upper bounds. More... | |
void | change_lb_ub_st (const BCP_obj_change &change) |
Set the lower/upper bounds and the status of the variable simultaneously to the values given in the data members of the argument. More... | |
void | change_bounds (const double lb, const double ub) |
Change the lower and upper bounds to the given values. More... | |
void | set_bcpind (const int bcpind) |
Set the internal index of the variable. More... | |
void | set_bcpind_flip () |
Flip the internal index of the variable to its negative. More... | |
Status modifying methods | |
void | set_status (const BCP_obj_status status) |
Set the status of the variable. More... | |
void | dont_send_to_pool (bool flag) |
Set/unset the flag controlling whether the variable could be sent to the Variable Pool process. More... | |
void | make_active () |
Mark the variable as active. More... | |
void | make_non_removable () |
Mark the variable as NotRemovable. More... | |
void | make_to_be_removed () |
Mark the variable as ToBeRemoved. More... | |
Display | |
void | display (const double val) const |
Display the object type, internal index, and the value given in the argument. More... | |
![]() | |
ReferencedObject () | |
virtual | ~ReferencedObject () |
int | ReferenceCount () const |
void | AddRef () const |
void | ReleaseRef () const |
Protected Attributes | |
Protected data members | |
BCP_var_t | _var_type |
The integrality type of the variable. More... | |
double | _obj |
The objective coefficient. More... | |
double | _lb |
Lower bound on the value the variable can take. More... | |
double | _ub |
Upper bound on the value the variable can take. More... | |
Private Member Functions | |
Disabled methods | |
BCP_var () | |
The default constructor is declared but not defined to disable it. More... | |
BCP_var (const BCP_var &) | |
The copy constructor is declared but not defined to disable it. More... | |
BCP_var & | operator= (const BCP_var &) |
The assignment operator is declared but not defined to disable it. More... | |
Private Attributes | |
Private data members | |
These are used only by BCP, the user need not worry about them. | |
int | _bcpind |
The internal, unique index of the variable. More... | |
BCP_obj_status | _status |
The status of the variable. More... | |
Abstract base class that defines members common to all types of variables.
Classes describing the three types of variables (core and algorithmic ) are derived from this class. No object of type BCP_var can exist (having purely virtual members in the class enforces this restriction).
Definition at line 28 of file BCP_var.hpp.
|
private |
The default constructor is declared but not defined to disable it.
(Just to make certain that the compiler doesn't generate it.)
|
private |
The copy constructor is declared but not defined to disable it.
|
inline |
The constructor sets the internal index of the variable to zero and the other data members to the given arguments.
Definition at line 71 of file BCP_var.hpp.
|
inlinevirtual |
The destructor is virtual so that the appropriate destructor is invoked for every variable.
Definition at line 77 of file BCP_var.hpp.
The assignment operator is declared but not defined to disable it.
|
pure virtual |
Return the type of the variable.
Implemented in BCP_var_algo, and BCP_var_core.
|
inline |
Return the integrality type of the variable.
Definition at line 85 of file BCP_var.hpp.
References _var_type.
|
inline |
Return the objective coefficient.
Definition at line 87 of file BCP_var.hpp.
References _obj.
Referenced by BCP_solution_generic::add_entry(), and set_obj().
|
inline |
Return the lower bound.
Definition at line 89 of file BCP_var.hpp.
References _lb.
Referenced by change_bounds(), set_lb(), and set_lb_ub().
|
inline |
Return the upper bound.
Definition at line 91 of file BCP_var.hpp.
References _ub.
Referenced by change_bounds(), set_lb_ub(), and set_ub().
|
inline |
Return the internal index of the variable.
Definition at line 93 of file BCP_var.hpp.
References _bcpind.
Referenced by BCP_var_core::BCP_var_core(), and set_bcpind().
|
inline |
Return the status of the variable.
Definition at line 98 of file BCP_var.hpp.
References _status.
Referenced by BCP_var_core::BCP_var_core(), and set_status().
|
inline |
Return whether the variable should be sent to the Variable Pool process.
(Assuming that it stays in the formulation long enough to qualify to be sent to the Variable Pool at all.
Definition at line 102 of file BCP_var.hpp.
References _status, and BCP_ObjDoNotSendToPool.
|
inline |
Return whether the variable is fixed or not.
Definition at line 106 of file BCP_var.hpp.
References _status, and BCP_ObjInactive.
|
inline |
Return whether the variable is fixed to zero or not.
Definition at line 110 of file BCP_var.hpp.
References _lb, _status, and BCP_ObjInactive.
Referenced by is_removable().
|
inline |
Return whether the variable is marked NotRemovable.
Examples of such variables include ???
Definition at line 115 of file BCP_var.hpp.
References _status, and BCP_ObjNotRemovable.
|
inline |
Return whether the variable is removable from the formulation at the time of the query.
(It is if it is not non_removable and it is fixed to zero.)
Definition at line 121 of file BCP_var.hpp.
References _status, BCP_ObjNotRemovable, and is_fixed_to_zero().
|
inline |
Return whether the variable must be removed from the formulation.
There are very few circumstances when this flag is set; all of them are completely internal to BCP.
Definition at line 127 of file BCP_var.hpp.
References _status, and BCP_ObjToBeRemoved.
|
inline |
Test (and set) whether the var is fixed (inactive)
Definition at line 136 of file BCP_var.hpp.
References _lb, _status, _ub, and BCP_ObjInactive.
Referenced by change_bounds(), change_lb_ub_st(), set_lb(), set_lb_ub(), and set_ub().
|
inline |
Set the integrality type of the variable.
Definition at line 141 of file BCP_var.hpp.
References _var_type.
|
inline |
Set the objective coefficient.
Definition at line 143 of file BCP_var.hpp.
Referenced by MKC_var::MKC_var().
|
inline |
Set the lower bound.
Definition at line 145 of file BCP_var.hpp.
References _lb, lb(), and test_inactive().
|
inline |
Set the upper bound.
Definition at line 150 of file BCP_var.hpp.
References _ub, test_inactive(), and ub().
|
inline |
Set both lower and upper bounds.
Definition at line 155 of file BCP_var.hpp.
References _lb, _ub, lb(), test_inactive(), and ub().
|
inline |
Set the lower/upper bounds and the status of the variable simultaneously to the values given in the data members of the argument.
Definition at line 163 of file BCP_var.hpp.
References _lb, _status, _ub, BCP_obj_change::lb, BCP_obj_change::stat, test_inactive(), and BCP_obj_change::ub.
|
inline |
Change the lower and upper bounds to the given values.
Definition at line 170 of file BCP_var.hpp.
References _lb, _ub, lb(), test_inactive(), and ub().
|
inline |
Set the internal index of the variable.
Definition at line 176 of file BCP_var.hpp.
References _bcpind, and bcpind().
Referenced by BCP_var_core::BCP_var_core().
|
inline |
Flip the internal index of the variable to its negative.
Definition at line 178 of file BCP_var.hpp.
References _bcpind.
|
inline |
Set the status of the variable.
Definition at line 183 of file BCP_var.hpp.
References _status, and status().
Referenced by BCP_var_core::BCP_var_core().
|
inline |
Set/unset the flag controlling whether the variable could be sent to the Variable Pool process.
Definition at line 186 of file BCP_var.hpp.
References _status, and BCP_ObjDoNotSendToPool.
|
inline |
Mark the variable as active.
Note that when this method is invoked the lp formulation must be modified as well: the original bounds of the variable must be reset.
Definition at line 195 of file BCP_var.hpp.
References _status, and BCP_ObjInactive.
|
inline |
Mark the variable as NotRemovable.
Definition at line 199 of file BCP_var.hpp.
References _status, BCP_ObjNotRemovable, and BCP_ObjToBeRemoved.
|
inline |
Mark the variable as ToBeRemoved.
It will actually be removed immediately after all variables that have to be marked this way are marked.
Definition at line 207 of file BCP_var.hpp.
References _status, and BCP_ObjToBeRemoved.
void BCP_var::display | ( | const double | val | ) | const |
Display the object type, internal index, and the value given in the argument.
(This value is usually the variable's value in an LP solution.)
|
private |
The internal, unique index of the variable.
Definition at line 46 of file BCP_var.hpp.
Referenced by bcpind(), set_bcpind(), and set_bcpind_flip().
|
private |
The status of the variable.
Definition at line 48 of file BCP_var.hpp.
Referenced by change_lb_ub_st(), dont_send_to_pool(), is_fixed(), is_fixed_to_zero(), is_non_removable(), is_removable(), is_to_be_removed(), make_active(), make_non_removable(), make_to_be_removed(), set_status(), status(), and test_inactive().
|
protected |
The integrality type of the variable.
Definition at line 55 of file BCP_var.hpp.
Referenced by set_var_type(), and var_type().
|
protected |
The objective coefficient.
Definition at line 57 of file BCP_var.hpp.
|
protected |
Lower bound on the value the variable can take.
Definition at line 59 of file BCP_var.hpp.
Referenced by change_bounds(), change_lb_ub_st(), is_fixed_to_zero(), lb(), set_lb(), set_lb_ub(), and test_inactive().
|
protected |
Upper bound on the value the variable can take.
Definition at line 61 of file BCP_var.hpp.
Referenced by change_bounds(), change_lb_ub_st(), set_lb_ub(), set_ub(), test_inactive(), and ub().