Dip-All  0.91.0
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 // 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_VAR_POOL_INCLUDE
18 #define DECOMP_VAR_POOL_INCLUDE
19 
20 #include "Decomp.h"
21 #include "DecompWaitingCol.h"
22 
24 
25 // --------------------------------------------------------------------- //
26 class is_less_thanD { //member of class instead??
27 public:
28  bool operator()( const DecompWaitingCol& x,
29  const DecompWaitingCol& y) {
30  return x.getVarPtr()->getReducedCost() < y.getVarPtr()->getReducedCost();
31  }
32 };
33 
34 // --------------------------------------------------------------------- //
35 class DecompVarPool : public std::vector<DecompWaitingCol> {
36 private:
39 
40 private:
41  static const char* classTag;
43 
44 public:
45  const inline bool colsAreValid() const {
46  return m_colsAreValid;
47  }
48  inline void setColsAreValid(bool colsAreValid) {
50  }
51 
52  void print(std::ostream* os = &std::cout) const; //THINK: virtual??
53  void reExpand(const DecompConstraintSet& modelCore,
54  const double tolZero);
55  bool isDuplicate(const DecompWaitingCol& wcol);
56  bool isDuplicate(const DecompVarList& vars,
57  const DecompWaitingCol& wcol);
58  bool isParallel(const DecompVarList& vars,
59  const DecompWaitingCol& wcol,
60  const double maxCosine);
61  bool setReducedCosts(const double* u,
62  const DecompStatus stat,
63  DecompVarPool::iterator first,
64  DecompVarPool::iterator last);
65  bool setReducedCosts(const double* u,
66  const DecompStatus stat) {
67  return setReducedCosts(u, stat, begin(), end());
68  }
69 
70 public:
72  m_colsAreValid(true) {}
73 
75  //---
76  //--- delete any memory that is left in the waiting cols
77  //---
78  std::vector<DecompWaitingCol>::iterator vi;
79 
80  for (vi = begin(); vi != end(); vi++) {
81  (*vi).deleteVar();
82  (*vi).deleteCol();
83  }
84  }
85 
86 };
87 
88 #endif
bool isDuplicate(const DecompWaitingCol &wcol)
double getReducedCost() const
Definition: DecompVar.h:54
void reExpand(const DecompConstraintSet &modelCore, const double tolZero)
DecompVarPool & operator=(const DecompVarPool &)
DecompStatus
Definition: Decomp.h:146
bool operator()(const DecompWaitingCol &x, const DecompWaitingCol &y)
Definition: DecompVarPool.h:28
void setColsAreValid(bool colsAreValid)
Definition: DecompVarPool.h:48
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:41
const bool colsAreValid() const
Definition: DecompVarPool.h:45
bool setReducedCosts(const double *u, const DecompStatus stat)
Definition: DecompVarPool.h:65
DecompVar * getVarPtr() const
void print(std::ostream *os=&std::cout) const
std::list< DecompVar * > DecompVarList
Definition: Decomp.h:53