Dip 0.95.0
Loading...
Searching...
No Matches
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
27class is_greater_thanD { //member of class instead??
28public:
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?
32 const DecompWaitingRow& y) {
33 return x.getViolation() > y.getViolation();
34 }
35};
36
37// --------------------------------------------------------------------- //
38class DecompCutPool : public std::vector<DecompWaitingRow> {
39private:
41 DecompCutPool& operator=(const DecompCutPool&);
42
43private:
44 static const char* classTag;
45 bool m_rowsAreValid;
46
47public:
48 const inline bool rowsAreValid() const {
49 return m_rowsAreValid;
50 }
51 inline void setRowsAreValid(bool rowsAreValid) {
52 m_rowsAreValid = 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
75public:
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
std::list< DecompVar * > DecompVarList
Definition Decomp.h:92
void setRowsAreValid(bool rowsAreValid)
const bool rowsAreValid() const
bool calcViolations(const double *x, DecompCutPool::iterator first, DecompCutPool::iterator last)
CoinPackedVector * createRowReform(const int n_coreCols, const CoinPackedVector *row, const DecompVarList &vars)
void print(std::ostream *os=&std::cout) const
bool calcViolations(const double *x)
void reExpand(const DecompVarList &vars, const int n_coreCols, const int n_artCols)
const double getViolation() const
bool operator()(const DecompWaitingRow &x, const DecompWaitingRow &y)