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

BCP_problem_core Class Reference

#include <BCP_problem_core.hpp>

List of all members.

Public Member Functions

Constructors and destructor
 BCP_problem_core ()
 BCP_problem_core (BCP_vec< BCP_var_core * > &v, BCP_vec< BCP_cut_core * > &c, BCP_lp_relax *&m)
 ~BCP_problem_core ()
Query methods
size_t varnum () const
size_t cutnum () const
Packing and unpacking methods
void pack (BCP_buffer &buf) const
void unpack (BCP_buffer &buf)

Public Attributes

Data members
BCP_vec< BCP_var_core * > vars
BCP_vec< BCP_cut_core * > cuts
BCP_lp_relaxmatrix

Private Member Functions

Private and disabled methods
void clear ()
 BCP_problem_core (const BCP_problem_core &)
BCP_problem_coreoperator= (const BCP_problem_core &)


Detailed Description

This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corresponding the core variables and cuts. Core cuts and variables never leave the formulation.

Definition at line 31 of file BCP_problem_core.hpp.


Constructor & Destructor Documentation

BCP_problem_core::BCP_problem_core const BCP_problem_core  )  [private]
 

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

BCP_problem_core::BCP_problem_core  ) 
 

The default constructor creates an empty core description: no variables/cuts and an empty matrix.

Definition at line 22 of file BCP_problem_core.cpp.

00022                                    :
00023   vars(), cuts(), matrix(new BCP_lp_relax(true /*colordered*/)) {}

BCP_problem_core::BCP_problem_core BCP_vec< BCP_var_core * > &  v,
BCP_vec< BCP_cut_core * > &  c,
BCP_lp_relax *&  m
[inline]
 

This constructor "takes over" the arguments. The created core description will have the content of the arguments in its data members while the arguments lose their content.

Definition at line 65 of file BCP_problem_core.hpp.

References cuts, matrix, BCP_vec< BCP_cut_core * >::swap(), BCP_vec< BCP_var_core * >::swap(), and vars.

00066                                        : vars(), cuts(), matrix(m) {
00067       vars.swap(v);
00068       cuts.swap(c);
00069       m = 0;
00070     }

BCP_problem_core::~BCP_problem_core  ) 
 

The desctructor deletes all data members.

Definition at line 25 of file BCP_problem_core.cpp.

References clear().

00026 {
00027   clear();
00028 }


Member Function Documentation

void BCP_problem_core::clear  )  [inline, private]
 

Delete all data members. This method purges the pointer vector members, i.e., deletes the object the pointers in the vectors point to.

Definition at line 14 of file BCP_problem_core.cpp.

References cuts, matrix, and vars.

Referenced by unpack(), and ~BCP_problem_core().

00014                                     {
00015    delete matrix;   matrix = 0;
00016    purge_ptr_vector(cuts);
00017    purge_ptr_vector(vars);
00018 }

size_t BCP_problem_core::cutnum  )  const [inline]
 

Return the number of cuts in the core.

Definition at line 80 of file BCP_problem_core.hpp.

References cuts, and BCP_vec< BCP_cut_core * >::size().

Referenced by BCP_problem_core_change::operator=().

00080 { return cuts.size(); }

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

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

void BCP_problem_core::pack BCP_buffer buf  )  const
 

Pack the contents of the core description into the buffer.

Definition at line 32 of file BCP_problem_core.cpp.

References BCP_cut::bcpind(), BCP_var::bcpind(), BCP_vec< BCP_cut_core * >::begin(), BCP_vec< BCP_var_core * >::begin(), cuts, BCP_vec< BCP_cut_core * >::end(), BCP_vec< BCP_var_core * >::end(), BCP_cut::lb(), BCP_var::lb(), matrix, BCP_var::obj(), BCP_cut_core::obj_type(), BCP_var_core::obj_type(), BCP_lp_relax::pack(), BCP_buffer::pack(), BCP_vec< BCP_cut_core * >::size(), BCP_vec< BCP_var_core * >::size(), BCP_cut::status(), BCP_var::status(), BCP_cut::ub(), BCP_var::ub(), BCP_var::var_type(), and vars.

00033 {
00034   buf.pack(vars.size());
00035   if (vars.size() > 0) {
00036     BCP_vec<BCP_var_core*>::const_iterator vi = vars.begin() - 1;
00037     const BCP_vec<BCP_var_core*>::const_iterator lastvi = vars.end();
00038     while (++vi != lastvi) {
00039       const BCP_var_core& var = **vi;
00040       const int bcpind = var.bcpind();
00041       const BCP_object_t obj_t = var.obj_type();
00042       const BCP_obj_status stat = var.status();
00043       const BCP_var_t var_t = var.var_type();
00044       const double obj = var.obj();
00045       const double lb = var.lb();
00046       const double ub = var.ub();
00047       buf.pack(bcpind)
00048          .pack(obj_t).pack(stat).pack(var_t).pack(obj).pack(lb).pack(ub);
00049     }
00050   }
00051 
00052   buf.pack(cuts.size());
00053   if (cuts.size() > 0) {
00054     BCP_vec<BCP_cut_core*>::const_iterator ci = cuts.begin() - 1;
00055     const BCP_vec<BCP_cut_core*>::const_iterator lastci = cuts.end();
00056     while (++ci != lastci) {
00057       BCP_cut_core& cut = **ci;
00058       const int bcpind = cut.bcpind();
00059       const BCP_object_t obj_t = cut.obj_type();
00060       const BCP_obj_status stat = cut.status();
00061       const double lb = cut.lb();
00062       const double ub = cut.ub();
00063       buf.pack(bcpind).pack(obj_t).pack(stat).pack(lb).pack(ub);
00064     }
00065   }
00066   
00067   matrix->pack(buf);
00068 }

void BCP_problem_core::unpack BCP_buffer buf  ) 
 

Unpack the contents of the core description from the buffer.

Definition at line 72 of file BCP_problem_core.cpp.

References clear(), cuts, matrix, BCP_vec< BCP_cut_core * >::reserve(), BCP_vec< BCP_var_core * >::reserve(), BCP_cut::set_bcpind(), BCP_var::set_bcpind(), BCP_cut::set_status(), BCP_var::set_status(), BCP_vec< BCP_cut_core * >::unchecked_push_back(), BCP_vec< BCP_var_core * >::unchecked_push_back(), BCP_lp_relax::unpack(), BCP_buffer::unpack(), and vars.

00073 {
00074   clear();
00075   size_t size;
00076   int bcpind;
00077   BCP_object_t obj_t;
00078   BCP_obj_status stat;
00079   BCP_var_t var_t;
00080   double obj;
00081   double lb;
00082   double ub;
00083 
00084   buf.unpack(size);
00085   if (size > 0) {
00086     BCP_var_core* bvar;
00087     for (vars.reserve(size); size; --size) {
00088       buf.unpack(bcpind)
00089          .unpack(obj_t).unpack(stat)
00090          .unpack(var_t).unpack(obj).unpack(lb).unpack(ub);
00091       bvar = new BCP_var_core(var_t, obj, lb, ub);
00092       bvar->set_bcpind(bcpind);
00093       bvar->set_status(stat);
00094       vars.unchecked_push_back(bvar);
00095     }
00096   }
00097 
00098   buf.unpack(size);
00099   if (size > 0) {
00100     BCP_cut_core* bcut;
00101     for (cuts.reserve(size); size; --size) {
00102       buf.unpack(bcpind).unpack(obj_t).unpack(stat).unpack(lb).unpack(ub);
00103       bcut = new BCP_cut_core(lb, ub);
00104       bcut->set_bcpind(bcpind);
00105       bcut->set_status(stat);
00106       cuts.unchecked_push_back(bcut);
00107       }
00108    }
00109 
00110    matrix = new BCP_lp_relax(true /*colordered*/);
00111    matrix->unpack(buf);
00112 }

size_t BCP_problem_core::varnum  )  const [inline]
 

Return the number of variables in the core.

Definition at line 78 of file BCP_problem_core.hpp.

References BCP_vec< BCP_var_core * >::size(), and vars.

Referenced by BCP_problem_core_change::operator=().

00078 { return vars.size(); }


Member Data Documentation

BCP_vec<BCP_cut_core*> BCP_problem_core::cuts
 

A vector of pointers to the cuts in the core of the problem. These are the cuts that always stay in the problem formulation.

Definition at line 51 of file BCP_problem_core.hpp.

Referenced by BCP_problem_core(), clear(), cutnum(), BCP_problem_core_change::operator=(), pack(), and unpack().

BCP_lp_relax* BCP_problem_core::matrix
 

A pointer to the constraint matrix corresponding to the core variables and cuts.

Definition at line 54 of file BCP_problem_core.hpp.

Referenced by BCP_problem_core(), clear(), pack(), and unpack().

BCP_vec<BCP_var_core*> BCP_problem_core::vars
 

A vector of pointers to the variables in the core of the problem. These are the variables that always stay in the problem formulation.

Definition at line 48 of file BCP_problem_core.hpp.

Referenced by BCP_problem_core(), clear(), BCP_problem_core_change::operator=(), pack(), unpack(), and varnum().


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