Dip 0.95.0
Loading...
Searching...
No Matches
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// --------------------------------------------------------------------- //
25class is_less_thanD { //member of class instead??
26public:
28 const DecompWaitingCol& y) {
29 return x.getVarPtr()->getReducedCost() < y.getVarPtr()->getReducedCost();
30 }
31};
32
33// --------------------------------------------------------------------- //
34class DecompVarPool : public std::vector<DecompWaitingCol> {
35private:
36 DecompVarPool(const DecompVarPool&);
37 DecompVarPool& operator=(const DecompVarPool&);
38
39private:
40 static const char* classTag;
41 bool m_colsAreValid;
42
43public:
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(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
69public:
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
DecompStatus
Definition Decomp.h:184
std::list< DecompVar * > DecompVarList
Definition Decomp.h:92
bool isDuplicate(const DecompVarList &vars, const DecompWaitingCol &wcol)
void print(double infinity, std::ostream *os=&std::cout) const
bool isParallel(const DecompVarList &vars, const DecompWaitingCol &wcol, const double maxCosine)
void setColsAreValid(bool colsAreValid)
void reExpand(const DecompConstraintSet &modelCore, const double tolZero)
bool setReducedCosts(const double *u, const DecompStatus stat, DecompVarPool::iterator first, DecompVarPool::iterator last)
bool setReducedCosts(const double *u, const DecompStatus stat)
bool isDuplicate(const DecompWaitingCol &wcol)
const bool colsAreValid() const
double getReducedCost() const
Definition DecompVar.h:53
DecompVar * getVarPtr() const
bool operator()(const DecompWaitingCol &x, const DecompWaitingCol &y)