Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

BCP_var Class Reference

#include <BCP_var.hpp>

Inheritance diagram for BCP_var:

BCP_var_algo BCP_var_core BCP_var_indexed List of all members.

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_varoperator= (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

Detailed Description

Abstract base class that defines members common to all types of variables. Classes describing the three types of variables (core , indexed 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.


Constructor & Destructor Documentation

BCP_var::BCP_var  )  [private]
 

The default constructor is declared but not defined to disable it. (Just to make certain that the compiler doesn't generate it.)

BCP_var::BCP_var const BCP_var  )  [private]
 

The copy constructor is declared but not defined to disable it.

BCP_var::BCP_var const BCP_var_t  var_type,
const double  obj,
const double  lb,
const double  ub
[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.

References _bcpind, _lb, _obj, _status, _ub, _var_type, and ub().

00072                                                                 :
00073        _bcpind(0), _status(BCP_ObjNoInfo),
00074        _var_type(var_type), _obj(obj), _lb(lb), _ub(ub) {}

virtual BCP_var::~BCP_var  )  [inline, virtual]
 

The destructor is virtual so that the appropriate destructor is invoked for every variable.

Definition at line 77 of file BCP_var.hpp.

00077 {}


Member Function Documentation

BCP_IndexType BCP_var::bcpind  )  const [inline]
 

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; }

void BCP_var::change_bounds const double  lb,
const double  ub
[inline]
 

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     }

void BCP_var::change_lb_ub_st const BCP_obj_change &  change  )  [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 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     }

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.)

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 }

void BCP_var::dont_send_to_pool bool  flag  )  [inline]
 

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.

00178                                                {
00179          _status =
00180            static_cast<BCP_obj_status>(flag ?
00181                                        _status | BCP_ObjDoNotSendToPool :
00182                                        _status & ~BCP_ObjDoNotSendToPool);
00183       }

bool BCP_var::dont_send_to_pool  )  const [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.

00102                                             {
00103         return _status & BCP_ObjDoNotSendToPool ? true : false;
00104       }

bool BCP_var::is_fixed  )  const [inline]
 

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       }

bool BCP_var::is_fixed_to_zero  )  const [inline]
 

Return whether the variable is fixed to zero or not.

Definition at line 110 of file BCP_var.hpp.

References _lb, and _status.

Referenced by is_removable().

00110                                            {
00111         return (_status & BCP_ObjInactive) && _lb == 0;
00112       }

bool BCP_var::is_non_removable  )  const [inline]
 

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       }

bool BCP_var::is_removable  )  const [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, and is_fixed_to_zero().

00121                                        {
00122         return (_status & BCP_ObjNotRemovable) ? false : is_fixed_to_zero();
00123       }

bool BCP_var::is_to_be_removed  )  const [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.

00127                                            {
00128         return (_status & BCP_ObjToBeRemoved) != 0;
00129       }

double BCP_var::lb  )  const [inline]
 

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; }

void BCP_var::make_active  )  [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 187 of file BCP_var.hpp.

References _status.

00187                                 {
00188          _status = static_cast<BCP_obj_status>(_status & ~BCP_ObjInactive);
00189       }

void BCP_var::make_non_removable  )  [inline]
 

Mark the variable as NotRemovable.

Definition at line 191 of file BCP_var.hpp.

References _status.

00191                                        {
00192          _status =
00193            static_cast<BCP_obj_status>((_status & ~BCP_ObjToBeRemoved) |
00194                                        BCP_ObjNotRemovable);
00195       }

void BCP_var::make_to_be_removed  )  [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 199 of file BCP_var.hpp.

References _status.

00199                                        {
00200          _status = BCP_ObjToBeRemoved;
00201       }

double BCP_var::obj  )  const [inline]
 

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; }

virtual BCP_object_t BCP_var::obj_type  )  const [pure virtual]
 

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().

BCP_var& BCP_var::operator= const BCP_var  )  [private]
 

The assignment operator is declared but not defined to disable it.

void BCP_var::set_bcpind const BCP_IndexType  bcpind  )  [inline]
 

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; }

void BCP_var::set_lb const double  lb  )  [inline]
 

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     }

void BCP_var::set_obj const double  obj  )  [inline]
 

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; }

void BCP_var::set_status const BCP_obj_status  status  )  [inline]
 

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; }

void BCP_var::set_ub const double  ub  )  [inline]
 

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     }

void BCP_var::set_var_type const BCP_var_t  type  )  [inline]
 

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; }

BCP_obj_status BCP_var::status  )  const [inline]
 

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; }

void BCP_var::test_inactive  )  [inline]
 

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().

00136                                 {
00137       if (_ub - _lb < 1e-8)
00138         _status = static_cast<BCP_obj_status>(_status | BCP_ObjInactive);
00139     }

double BCP_var::ub  )  const [inline]
 

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; }

BCP_var_t BCP_var::var_type  )  const [inline]
 

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; }


Member Data Documentation

BCP_IndexType BCP_var::_bcpind [private]
 

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().

double BCP_var::_lb [protected]
 

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().

double BCP_var::_obj [protected]
 

The objective coefficient.

Definition at line 57 of file BCP_var.hpp.

Referenced by BCP_var(), obj(), and set_obj().

BCP_obj_status BCP_var::_status [private]
 

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().

double BCP_var::_ub [protected]
 

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().

BCP_var_t BCP_var::_var_type [protected]
 

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().


The documentation for this class was generated from the following files:
Generated on Wed Dec 3 14:32:42 2003 for BCP by doxygen 1.3.5