DecompCutPool.h

Go to the documentation of this file.
00001 //===========================================================================//
00002 // This file is part of the DIP Solver Framework.                            //
00003 //                                                                           //
00004 // DIP is distributed under the Eclipse 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 // Conceptual Design: Matthew Galati, SAS Institute Inc.                     //
00010 //                    Ted Ralphs, Lehigh University                          //
00011 //                                                                           //
00012 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, Ted Ralphs    //
00013 // All Rights Reserved.                                                      //
00014 //===========================================================================//
00015 
00016 
00017 #ifndef DECOMP_CUT_POOL_INCLUDE
00018 #define DECOMP_CUT_POOL_INCLUDE
00019 
00020 #include "DecompWaitingRow.h"
00021 
00022 #include <functional>
00023 
00024 class DecompConstraintSet;
00025 
00026 // --------------------------------------------------------------------- //
00027 //TODO: switch to distance
00028 class is_greater_thanD { //member of class instead??
00029 public:
00030    //TODO: design, waitingcol, rc is member of var, not waiting col,
00031    //but for waitingrow, distance is member of wr, not of cut - why?
00032    bool operator()( const DecompWaitingRow& x,
00033                     const DecompWaitingRow& y) {
00034       return x.getViolation() > y.getViolation();
00035    }
00036 };
00037 
00038 // --------------------------------------------------------------------- //
00039 class DecompCutPool : public std::vector<DecompWaitingRow> {
00040 private:
00041    DecompCutPool(const DecompCutPool&);
00042    DecompCutPool& operator=(const DecompCutPool&);
00043 
00044 private:
00045    static const char* classTag;
00046    bool m_rowsAreValid;
00047 
00048 public:
00049    const inline bool rowsAreValid() const {
00050       return m_rowsAreValid;
00051    }
00052    inline void setRowsAreValid(bool rowsAreValid) {
00053       m_rowsAreValid = rowsAreValid;
00054    }
00055 
00056    void print(std::ostream* os = &std::cout) const;  //THINK: virtual??
00057    void reExpand(const DecompVarList& vars,
00058                  const int             n_coreCols,
00059                  const int             n_artCols);
00060 
00061    CoinPackedVector* createRowReform(const int                n_coreCols,
00062                                      //const int                n_artCols,
00063                                      const CoinPackedVector* row,
00064                                      const DecompVarList&     vars);
00065 
00066    //THINK
00067    //bool isDuplicate(const DecompWaitingRow & wcol);
00068 
00069    bool calcViolations(const double*             x,
00070                        DecompCutPool::iterator   first,
00071                        DecompCutPool::iterator   last);
00072    bool calcViolations(const double*             x) {
00073       return calcViolations(x, begin(), end());
00074    }
00075 
00076 public:
00077    DecompCutPool() :
00078       m_rowsAreValid(true) {}
00079 
00080    ~DecompCutPool() {
00081       //---
00082       //--- delete any memory that is left in the waiting rows
00083       //---
00084       std::vector<DecompWaitingRow>::iterator vi;
00085 
00086       for (vi = begin(); vi != end(); vi++) {
00087          (*vi).deleteCut();
00088          (*vi).deleteRow();
00089          (*vi).deleteRowReform();
00090       }
00091    }
00092 
00093 };
00094 
00095 #endif

Generated on 12 Mar 2015 for Dip-All by  doxygen 1.6.1