DecompVarPool.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef DECOMP_VAR_POOL_INCLUDE
00015 #define DECOMP_VAR_POOL_INCLUDE
00016
00017 #include "DecompWaitingCol.h"
00018
00019 #include <functional>
00020 using namespace std;
00021
00022 class DecompConstraintSet;
00023
00024
00025 class is_less_thanD {
00026 public:
00027 bool operator()( const DecompWaitingCol& x,
00028 const DecompWaitingCol& y) {
00029 return x.getVarPtr()->getReducedCost() < y.getVarPtr()->getReducedCost();
00030 }
00031 };
00032
00033
00034 class DecompVarPool : public std::vector<DecompWaitingCol> {
00035 private:
00036 DecompVarPool(const DecompVarPool&);
00037 DecompVarPool& operator=(const DecompVarPool&);
00038
00039 private:
00040 static const char* classTag;
00041 bool m_colsAreValid;
00042
00043 public:
00044 const inline bool colsAreValid() const {
00045 return m_colsAreValid;
00046 }
00047 inline void setColsAreValid(bool colsAreValid) {
00048 m_colsAreValid = colsAreValid;
00049 }
00050
00051 void print(ostream* os = &cout) const;
00052 void reExpand(const DecompConstraintSet& modelCore,
00053 const double tolZero);
00054 bool isDuplicate(const DecompWaitingCol& wcol);
00055 bool isDuplicate(const DecompVarList& vars,
00056 const DecompWaitingCol& wcol);
00057 bool setReducedCosts(const double* u,
00058 const decompStat stat,
00059 DecompVarPool::iterator first,
00060 DecompVarPool::iterator last);
00061 bool setReducedCosts(const double* u,
00062 const decompStat stat) {
00063 return setReducedCosts(u, stat, begin(), end());
00064 }
00065
00066 public:
00067 DecompVarPool() :
00068 m_colsAreValid(true) {}
00069
00070 ~DecompVarPool() {
00071
00072
00073
00074 vector<DecompWaitingCol>::iterator vi;
00075
00076 for (vi = begin(); vi != end(); vi++) {
00077 (*vi).deleteVar();
00078 (*vi).deleteCol();
00079 }
00080 }
00081
00082 };
00083
00084 #endif