#include <BCP_var.hpp>
Inheritance diagram for BCP_var:
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) | |
virtual | ~BCP_var () |
Query methods | |
virtual BCP_object_t | obj_type () const=0 |
BCP_var_t | var_type () const |
double | obj () const |
double | lb () const |
double | ub () const |
BCP_IndexType | bcpind () const |
Query methods about the status of the variable | |
BCP_obj_status | status () const |
bool | dont_send_to_pool () const |
bool | is_fixed () const |
bool | is_fixed_to_zero () const |
bool | is_non_removable () const |
bool | is_removable () const |
bool | is_to_be_removed () const |
Modifying methods | |
void | test_inactive () |
void | set_var_type (const BCP_var_t type) |
void | set_obj (const double obj) |
void | set_lb (const double lb) |
void | set_ub (const double ub) |
void | change_lb_ub_st (const BCP_obj_change &change) |
void | change_bounds (const double lb, const double ub) |
void | set_bcpind (const BCP_IndexType bcpind) |
Status modifying methods | |
void | set_status (const BCP_obj_status status) |
void | dont_send_to_pool (bool flag) |
void | make_active () |
void | make_non_removable () |
void | make_to_be_removed () |
Display | |
void | display (const double val) const |
Protected Attributes | |
Protected data members | |
BCP_var_t | _var_type |
double | _obj |
double | _lb |
double | _ub |
Private Member Functions | |
Disabled methods | |
BCP_var () | |
BCP_var (const BCP_var &) | |
BCP_var & | operator= (const BCP_var &) |
Private Attributes | |
Private data members | |
These are used only by BCP, the user need not worry about them. | |
BCP_IndexType | _bcpind |
BCP_obj_status | _status |
Definition at line 28 of file BCP_var.hpp.
|
The default constructor is declared but not defined to disable it. (Just to make certain that the compiler doesn't generate it.) |
|
The copy constructor is declared but not defined to disable it. |
|
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. References _bcpind, _lb, _obj, _status, _ub, _var_type, and ub().
|
|
The destructor is virtual so that the appropriate destructor is invoked for every variable. Definition at line 77 of file BCP_var.hpp.
00077 {} |
|
Return the internal index of the variable. Definition at line 93 of file BCP_var.hpp. References _bcpind. Referenced by BCP_problem_core::pack(), and BCP_vg_user::send_var().
00093 { return _bcpind; } |
|
Change the lower and upper bounds to the given values. Definition at line 164 of file BCP_var.hpp. References _lb, _ub, and test_inactive(). Referenced by BCP_cg_prob::unpack_var().
00164 { 00165 _lb = lb; 00166 _ub = ub; 00167 test_inactive(); 00168 } |
|
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 157 of file BCP_var.hpp. References _lb, _status, _ub, and test_inactive().
00157 { 00158 _lb = change.lb; 00159 _ub = change.ub; 00160 _status = change.stat; 00161 test_inactive(); 00162 } |
|
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.) Definition at line 71 of file BCP_var.cpp. References _bcpind, and obj_type().
00072 { 00073 switch (obj_type()) { 00074 case BCP_CoreObj: 00075 printf(" Core var (internal index: %6i ) at %.4f\n", 00076 _bcpind, val); 00077 break; 00078 case BCP_IndexedObj: 00079 printf(" Indexed var (internal index: %6i, user index: %6i) at %.4f\n", 00080 _bcpind,(dynamic_cast<const BCP_var_indexed*>(this))->index(), val); 00081 break; 00082 case BCP_AlgoObj: 00083 printf(" Algo var (internal index: %6i ) at %.4f\n", 00084 _bcpind, val); 00085 break; 00086 default: 00087 throw BCP_fatal_error("Untyped object in BCP_solution_gen::display()\n"); 00088 } 00089 } |
|
Set/unset the flag controlling whether the variable could be sent to the Variable Pool process. Definition at line 178 of file BCP_var.hpp. References _status.
|
|
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.
00102 { 00103 return _status & BCP_ObjDoNotSendToPool ? true : false; 00104 } |
|
Return whether the variable is fixed or not. Definition at line 106 of file BCP_var.hpp. References _status. Referenced by BCP_lp_user::reduced_cost_fixing().
00106 { 00107 return (_status & BCP_ObjInactive) != 0; 00108 } |
|
Return whether the variable is fixed to zero or not. Definition at line 110 of file BCP_var.hpp. Referenced by is_removable().
|
|
Return whether the variable is marked NotRemovable. Examples of such variables include ??? Definition at line 115 of file BCP_var.hpp. References _status.
00115 { 00116 return (_status & BCP_ObjNotRemovable) ? true : false; 00117 } |
|
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, and is_fixed_to_zero().
00121 { 00122 return (_status & BCP_ObjNotRemovable) ? false : is_fixed_to_zero(); 00123 } |
|
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.
00127 { 00128 return (_status & BCP_ObjToBeRemoved) != 0; 00129 } |
|
Return the lower bound. Definition at line 89 of file BCP_var.hpp. References _lb. Referenced by BCP_problem_core_change::BCP_problem_core_change(), BCP_problem_core::pack(), BCP_lp_user::reduced_cost_fixing(), BCP_vg_user::send_var(), BCP_lp_user::test_full(), and BCP_lp_user::test_integral().
00089 { return _lb; } |
|
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 187 of file BCP_var.hpp. References _status.
|
|
Mark the variable as NotRemovable. Definition at line 191 of file BCP_var.hpp. References _status.
|
|
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 199 of file BCP_var.hpp. References _status.
00199 { 00200 _status = BCP_ObjToBeRemoved; 00201 } |
|
Return the objective coefficient. Definition at line 87 of file BCP_var.hpp. References _obj. Referenced by BCP_solution_generic::add_entry(), BCP_problem_core::pack(), and BCP_vg_user::send_var().
00087 { return _obj; } |
|
Return the type of the variable. Implemented in BCP_var_core, BCP_var_indexed, and BCP_var_algo. Referenced by display(), and BCP_vg_user::send_var(). |
|
The assignment operator is declared but not defined to disable it. |
|
Set the internal index of the variable. Definition at line 170 of file BCP_var.hpp. References _bcpind. Referenced by BCP_var_core::BCP_var_core(), BCP_problem_core::unpack(), BCP_tm_user::unpack_feasible_solution(), and BCP_cg_prob::unpack_var().
00170 { _bcpind = bcpind; } |
|
Set the lower bound. Definition at line 145 of file BCP_var.hpp. References _lb, and test_inactive(). Referenced by BCP_lp_user::reduced_cost_fixing().
00145 { 00146 _lb = lb; 00147 test_inactive(); 00148 } |
|
Set the objective coefficient. Definition at line 143 of file BCP_var.hpp. References _obj. Referenced by BCP_cg_prob::unpack_var().
00143 { _obj = obj; } |
|
Set the status of the variable. Definition at line 175 of file BCP_var.hpp. References _status. Referenced by BCP_var_core::BCP_var_core(), BCP_problem_core::unpack(), and BCP_cg_prob::unpack_var().
00175 { _status = status; } |
|
Set the upper bound. Definition at line 150 of file BCP_var.hpp. References _ub, and test_inactive(). Referenced by BCP_lp_user::reduced_cost_fixing().
00150 { 00151 _ub = ub; 00152 test_inactive(); 00153 } |
|
Set the integrality type of the variable. Definition at line 141 of file BCP_var.hpp. References _var_type. Referenced by BCP_cg_prob::unpack_var().
00141 { _var_type = type; } |
|
Return the status of the variable. Definition at line 98 of file BCP_var.hpp. References _status. Referenced by BCP_problem_core_change::BCP_problem_core_change(), BCP_problem_core::pack(), and BCP_vg_user::send_var().
00098 { return _status; } |
|
Test (and set) whether the var is fixed (inactive) Definition at line 136 of file BCP_var.hpp. References _lb, _status, and _ub. Referenced by change_bounds(), change_lb_ub_st(), set_lb(), and set_ub().
|
|
Return the upper bound. Definition at line 91 of file BCP_var.hpp. References _ub. Referenced by BCP_problem_core_change::BCP_problem_core_change(), BCP_var(), BCP_problem_core::pack(), BCP_lp_user::reduced_cost_fixing(), BCP_vg_user::send_var(), BCP_lp_user::test_full(), and BCP_lp_user::test_integral().
00091 { return _ub; } |
|
Return the integrality type of the variable. Definition at line 85 of file BCP_var.hpp. References _var_type. Referenced by BCP_problem_core::pack(), BCP_lp_user::reduced_cost_fixing(), BCP_vg_user::send_var(), and BCP_lp_user::test_full().
00085 { return _var_type; } |
|
The internal, unique index of the variable. Definition at line 46 of file BCP_var.hpp. Referenced by BCP_var(), bcpind(), display(), and set_bcpind(). |
|
Lower bound on the value the variable can take. Definition at line 59 of file BCP_var.hpp. Referenced by BCP_var(), change_bounds(), change_lb_ub_st(), is_fixed_to_zero(), lb(), set_lb(), and test_inactive(). |
|
The objective coefficient. Definition at line 57 of file BCP_var.hpp. |
|
The status of the variable. Definition at line 48 of file BCP_var.hpp. Referenced by BCP_var(), 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(). |
|
Upper bound on the value the variable can take. Definition at line 61 of file BCP_var.hpp. Referenced by BCP_var(), change_bounds(), change_lb_ub_st(), set_ub(), test_inactive(), and ub(). |
|
The integrality type of the variable. Definition at line 55 of file BCP_var.hpp. Referenced by BCP_var(), set_var_type(), and var_type(). |