Dip-All  0.91.0
DecompCutPool.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the DIP Solver Framework. //
3 // //
4 // DIP is distributed under the Eclipse Public License as part of the //
5 // COIN-OR repository (http://www.coin-or.org). //
6 // //
7 // Author: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // //
9 // Conceptual Design: Matthew Galati, SAS Institute Inc. //
10 // Ted Ralphs, Lehigh University //
11 // //
12 // Copyright (C) 2002-2015, Lehigh University, Matthew Galati, Ted Ralphs //
13 // All Rights Reserved. //
14 //===========================================================================//
15 
16 
17 #ifndef DECOMP_CUT_POOL_INCLUDE
18 #define DECOMP_CUT_POOL_INCLUDE
19 
20 #include "DecompWaitingRow.h"
21 
22 #include <functional>
23 
25 
26 // --------------------------------------------------------------------- //
27 //TODO: switch to distance
28 class is_greater_thanD { //member of class instead??
29 public:
30  //TODO: design, waitingcol, rc is member of var, not waiting col,
31  //but for waitingrow, distance is member of wr, not of cut - why?
32  bool operator()( const DecompWaitingRow& x,
33  const DecompWaitingRow& y) {
34  return x.getViolation() > y.getViolation();
35  }
36 };
37 
38 // --------------------------------------------------------------------- //
39 class DecompCutPool : public std::vector<DecompWaitingRow> {
40 private:
43 
44 private:
45  static const char* classTag;
47 
48 public:
49  const inline bool rowsAreValid() const {
50  return m_rowsAreValid;
51  }
52  inline void setRowsAreValid(bool rowsAreValid) {
54  }
55 
56  void print(std::ostream* os = &std::cout) const; //THINK: virtual??
57  void reExpand(const DecompVarList& vars,
58  const int n_coreCols,
59  const int n_artCols);
60 
61  CoinPackedVector* createRowReform(const int n_coreCols,
62  //const int n_artCols,
63  const CoinPackedVector* row,
64  const DecompVarList& vars);
65 
66  //THINK
67  //bool isDuplicate(const DecompWaitingRow & wcol);
68 
69  bool calcViolations(const double* x,
70  DecompCutPool::iterator first,
71  DecompCutPool::iterator last);
72  bool calcViolations(const double* x) {
73  return calcViolations(x, begin(), end());
74  }
75 
76 public:
78  m_rowsAreValid(true) {}
79 
81  //---
82  //--- delete any memory that is left in the waiting rows
83  //---
84  std::vector<DecompWaitingRow>::iterator vi;
85 
86  for (vi = begin(); vi != end(); vi++) {
87  (*vi).deleteCut();
88  (*vi).deleteRow();
89  (*vi).deleteRowReform();
90  }
91  }
92 
93 };
94 
95 #endif
void setRowsAreValid(bool rowsAreValid)
Definition: DecompCutPool.h:52
static const char * classTag
Definition: DecompCutPool.h:45
bool calcViolations(const double *x, DecompCutPool::iterator first, DecompCutPool::iterator last)
const double getViolation() const
CoinPackedVector * createRowReform(const int n_coreCols, const CoinPackedVector *row, const DecompVarList &vars)
bool calcViolations(const double *x)
Definition: DecompCutPool.h:72
DecompCutPool & operator=(const DecompCutPool &)
void print(std::ostream *os=&std::cout) const
Sparse Vector.
bool operator()(const DecompWaitingRow &x, const DecompWaitingRow &y)
Definition: DecompCutPool.h:32
void reExpand(const DecompVarList &vars, const int n_coreCols, const int n_artCols)
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53
const bool rowsAreValid() const
Definition: DecompCutPool.h:49