Dip  0.92.4
DecompVarPool.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_VAR_POOL_INCLUDE
17 #define DECOMP_VAR_POOL_INCLUDE
18 
19 #include "Decomp.h"
20 #include "DecompWaitingCol.h"
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:
38 
39 private:
40  static const char* classTag;
42 
43 public:
44  const inline bool colsAreValid() const {
45  return m_colsAreValid;
46  }
47  inline void setColsAreValid(bool colsAreValid) {
49  }
50 
51  void print(double infinity, std::ostream* os = &std::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 isParallel(const DecompVarList& vars,
58  const DecompWaitingCol& wcol,
59  const double maxCosine);
60  bool setReducedCosts(const double* u,
61  const DecompStatus stat,
62  DecompVarPool::iterator first,
63  DecompVarPool::iterator last);
64  bool setReducedCosts(const double* u,
65  const DecompStatus stat) {
66  return setReducedCosts(u, stat, begin(), end());
67  }
68 
69 public:
71  m_colsAreValid(true) {}
72 
74  //---
75  //--- delete any memory that is left in the waiting cols
76  //---
77  std::vector<DecompWaitingCol>::iterator vi;
78 
79  for (vi = begin(); vi != end(); vi++) {
80  (*vi).deleteVar();
81  (*vi).deleteCol();
82  }
83  }
84 
85 };
86 
87 #endif
bool isDuplicate(const DecompWaitingCol &wcol)
double getReducedCost() const
Definition: DecompVar.h:53
void reExpand(const DecompConstraintSet &modelCore, const double tolZero)
DecompVarPool & operator=(const DecompVarPool &)
DecompStatus
Definition: Decomp.h:184
void print(double infinity, std::ostream *os=&std::cout) const
bool operator()(const DecompWaitingCol &x, const DecompWaitingCol &y)
Definition: DecompVarPool.h:27
void setColsAreValid(bool colsAreValid)
Definition: DecompVarPool.h:47
bool isParallel(const DecompVarList &vars, const DecompWaitingCol &wcol, const double maxCosine)
bool setReducedCosts(const double *u, const DecompStatus stat, DecompVarPool::iterator first, DecompVarPool::iterator last)
static const char * classTag
Definition: DecompVarPool.h:40
const bool colsAreValid() const
Definition: DecompVarPool.h:44
bool setReducedCosts(const double *u, const DecompStatus stat)
Definition: DecompVarPool.h:64
DecompVar * getVarPtr() const
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:91