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