DecompVarPool.h

Go to the documentation of this file.
00001 //===========================================================================//
00002 // This file is part of the Decomp Solver Framework.                         //
00003 //                                                                           //
00004 // Decomp is distributed under the Common Public License as part of the      //
00005 // COIN-OR repository (http://www.coin-or.org).                              //
00006 //                                                                           //
00007 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com)       //
00008 //                                                                           //
00009 // Copyright (C) 2002-2007, Lehigh University, Matthew Galati, and Ted Ralphs//
00010 // All Rights Reserved.                                                      //
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 { //member of class instead??
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;  //THINK: virtual??
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       //--- delete any memory that is left in the waiting cols
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

Generated on 5 Apr 2015 for Dip-All by  doxygen 1.6.1