Dip  0.92.4
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 // Authors: Matthew Galati, SAS Institute Inc. (matthew.galati@sas.com) //
8 // Ted Ralphs, Lehigh University (ted@lehigh.edu) //
9 // Jiadong Wang, Lehigh University (jiw408@lehigh.edu) //
10 // //
11 // Copyright (C) 2002-2019, Lehigh University, Matthew Galati, Ted Ralphs //
12 // All Rights Reserved. //
13 //===========================================================================//
14 
15 
16 #ifndef DECOMP_CUT_POOL_INCLUDE
17 #define DECOMP_CUT_POOL_INCLUDE
18 
19 #include "DecompWaitingRow.h"
20 
21 #include <functional>
22 
24 
25 // --------------------------------------------------------------------- //
26 //TODO: switch to distance
27 class is_greater_thanD { //member of class instead??
28 public:
29  //TODO: design, waitingcol, rc is member of var, not waiting col,
30  //but for waitingrow, distance is member of wr, not of cut - why?
31  bool operator()( const DecompWaitingRow& x,
32  const DecompWaitingRow& y) {
33  return x.getViolation() > y.getViolation();
34  }
35 };
36 
37 // --------------------------------------------------------------------- //
38 class DecompCutPool : public std::vector<DecompWaitingRow> {
39 private:
42 
43 private:
44  static const char* classTag;
46 
47 public:
48  const inline bool rowsAreValid() const {
49  return m_rowsAreValid;
50  }
51  inline void setRowsAreValid(bool rowsAreValid) {
53  }
54 
55  void print(std::ostream* os = &std::cout) const; //THINK: virtual??
56  void reExpand(const DecompVarList& vars,
57  const int n_coreCols,
58  const int n_artCols);
59 
60  CoinPackedVector* createRowReform(const int n_coreCols,
61  //const int n_artCols,
62  const CoinPackedVector* row,
63  const DecompVarList& vars);
64 
65  //THINK
66  //bool isDuplicate(const DecompWaitingRow & wcol);
67 
68  bool calcViolations(const double* x,
69  DecompCutPool::iterator first,
70  DecompCutPool::iterator last);
71  bool calcViolations(const double* x) {
72  return calcViolations(x, begin(), end());
73  }
74 
75 public:
77  m_rowsAreValid(true) {}
78 
80  //---
81  //--- delete any memory that is left in the waiting rows
82  //---
83  std::vector<DecompWaitingRow>::iterator vi;
84 
85  for (vi = begin(); vi != end(); vi++) {
86  (*vi).deleteCut();
87  (*vi).deleteRow();
88  (*vi).deleteRowReform();
89  }
90  }
91 
92 };
93 
94 #endif
void setRowsAreValid(bool rowsAreValid)
Definition: DecompCutPool.h:51
static const char * classTag
Definition: DecompCutPool.h:44
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:71
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:31
void reExpand(const DecompVarList &vars, const int n_coreCols, const int n_artCols)
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91
const bool rowsAreValid() const
Definition: DecompCutPool.h:48