Dip  0.92.4
DecompVarPool.h
Go to the documentation of this file.
1 //===========================================================================//
2 // This file is part of the Decomp Solver Framework. //
3 // //
4 // Decomp is distributed under the Common 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 // Copyright (C) 2002-2007, Lehigh University, Matthew Galati, and Ted Ralphs//
10 // All Rights Reserved. //
11 //===========================================================================//
12 
13 
14 #ifndef DECOMP_VAR_POOL_INCLUDE
15 #define DECOMP_VAR_POOL_INCLUDE
16 
17 #include "DecompWaitingCol.h"
18 
19 #include <functional>
20 using namespace std;
21 
23 
24 // --------------------------------------------------------------------- //
25 class is_less_thanD { //member of class instead??
26 public:
27  bool operator()( const DecompWaitingCol& x,
28  const DecompWaitingCol& y) {
29  return x.getVarPtr()->getReducedCost() < y.getVarPtr()->getReducedCost();
30  }
31 };
32 
33 // --------------------------------------------------------------------- //
34 class DecompVarPool : public std::vector<DecompWaitingCol> {
35 private:
37  DecompVarPool& operator=(const DecompVarPool&);
38 
39 private:
40  static const char* classTag;
41  bool m_colsAreValid;
42 
43 public:
44  const inline bool colsAreValid() const {
45  return m_colsAreValid;
46  }
47  inline void setColsAreValid(bool colsAreValid) {
48  m_colsAreValid = colsAreValid;
49  }
50 
51  void print(ostream* os = &cout) const; //THINK: virtual??
52  void reExpand(const DecompConstraintSet& modelCore,
53  const double tolZero);
54  bool isDuplicate(const DecompWaitingCol& wcol);
55  bool isDuplicate(const DecompVarList& vars,
56  const DecompWaitingCol& wcol);
57  bool setReducedCosts(const double* u,
58  const decompStat stat,
59  DecompVarPool::iterator first,
60  DecompVarPool::iterator last);
61  bool setReducedCosts(const double* u,
62  const decompStat stat) {
63  return setReducedCosts(u, stat, begin(), end());
64  }
65 
66 public:
68  m_colsAreValid(true) {}
69 
71  //---
72  //--- delete any memory that is left in the waiting cols
73  //---
74  vector<DecompWaitingCol>::iterator vi;
75 
76  for (vi = begin(); vi != end(); vi++) {
77  (*vi).deleteVar();
78  (*vi).deleteCol();
79  }
80  }
81 
82 };
83 
84 #endif
double getReducedCost() const
Definition: DecompVar.h:53
bool operator()(const DecompWaitingCol &x, const DecompWaitingCol &y)
Definition: DecompVarPool.h:27
void setColsAreValid(bool colsAreValid)
Definition: DecompVarPool.h:47
bool setReducedCosts(const double *u, const decompStat stat)
Definition: DecompVarPool.h:61
const bool colsAreValid() const
Definition: DecompVarPool.h:44
decompStat
DecompVar * getVarPtr() const
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91