Dip  0.95.0
DippyDecompAlgo.h
Go to the documentation of this file.
1 #ifndef DIPPY_DECOMPALGO_INCLUDED
2 #define DIPPY_DECOMPALGO_INCLUDED
3 
4 #include "Decomp.h"
5 #include "DecompAlgoC.h"
6 #include "DecompAlgoPC.h"
7 #include "DecompAlgoRC.h"
8 #include "DecompAlgoD.h"
9 #include "DecompCutPool.h"
10 #include "AlpsDecompTreeNode.h"
11 
12 #include "Python.h"
13 
23 private:
24  PyObject* pDownLB;
25  PyObject* pDownUB;
26  PyObject* pUpLB;
27  PyObject* pUpUB;
28 
29 protected:
30  PyObject* m_pProb;
32 public:
39  DippyAlgoMixin(UtilParameters& utilParam, PyObject* pProb)
40  : pDownLB(NULL), pDownUB(NULL), pUpLB(NULL), pUpUB(NULL),
41  m_pProb(pProb), m_utilParam(&utilParam) {
42  }
43 
44  bool chooseBranchSet(DecompAlgo* algo,
45  std::vector< std::pair<int, double> >& downBranchLB,
46  std::vector< std::pair<int, double> >& downBranchUB,
47  std::vector< std::pair<int, double> >& upBranchLB,
48  std::vector< std::pair<int, double> >& upBranchUB);
49 
50  PyObject* getPDownLB() {
51  return pDownLB;
52  };
53  PyObject* getPDownUB() {
54  return pDownUB;
55  };
56  PyObject* getPUpLB() {
57  return pUpLB;
58  };
59  PyObject* getPpUpUB() {
60  return pUpUB;
61  };
62 
63  void postProcessBranch(DecompAlgo* algo, DecompStatus decompStatus);
64 
65  void postProcessNode(DecompAlgo* algo, DecompStatus decompStatus);
66 
67 };
68 
74 public:
75  DippyAlgoC(DecompApp* app, UtilParameters& utilParam, PyObject* pProb)
76  : DippyAlgoMixin(utilParam, pProb), DecompAlgoC(app, utilParam) {
77  }
78 
79  virtual bool chooseBranchSet(
80  std::vector< std::pair<int, double> >& downBranchLB,
81  std::vector< std::pair<int, double> >& downBranchUB,
82  std::vector< std::pair<int, double> >& upBranchLB,
83  std::vector< std::pair<int, double> >& upBranchUB) {
84  bool ret_val = DippyAlgoMixin::chooseBranchSet(this, downBranchLB, downBranchUB,
85  upBranchLB, upBranchUB);
86  return ret_val;
87  }
88 
89  virtual void postProcessBranch(DecompStatus decompStatus) {
90  DippyAlgoMixin::postProcessBranch(this, decompStatus);
91  }
92 
93  virtual void postProcessNode(DecompStatus decompStatus) {
94  DippyAlgoMixin::postProcessNode(this, decompStatus);
95  }
96 
97 };
98 
104 public:
105  DippyAlgoPC(DecompApp* app, UtilParameters& utilParam, PyObject* pProb)
106  : DippyAlgoMixin(utilParam, pProb), DecompAlgoPC(app, utilParam) {
107  }
108 
109  virtual bool chooseBranchSet(std::vector< std::pair<int, double> >& downBranchLB,
110  std::vector< std::pair<int, double> >& downBranchUB,
111  std::vector< std::pair<int, double> >& upBranchLB,
112  std::vector< std::pair<int, double> >& upBranchUB) {
113  return DippyAlgoMixin::chooseBranchSet(this, downBranchLB, downBranchUB,
114  upBranchLB, upBranchUB);
115  }
116 
117  virtual void postProcessBranch(DecompStatus decompStatus) {
118  DippyAlgoMixin::postProcessBranch(this, decompStatus);
119  }
120 
121  virtual void postProcessNode(DecompStatus decompStatus) {
122  DippyAlgoMixin::postProcessNode(this, decompStatus);
123  }
124 
125 };
126 
132 public:
133  DippyAlgoRC(DecompApp* app, UtilParameters& utilParam, PyObject* pProb)
134  : DippyAlgoMixin(utilParam, pProb), DecompAlgoRC(app, utilParam) {
135  }
136 
137  virtual bool chooseBranchSet(std::vector< std::pair<int, double> >& downBranchLB,
138  std::vector< std::pair<int, double> >& downBranchUB,
139  std::vector< std::pair<int, double> >& upBranchLB,
140  std::vector< std::pair<int, double> >& upBranchUB) {
141  return DippyAlgoMixin::chooseBranchSet(this, downBranchLB, downBranchUB,
142  upBranchLB, upBranchUB);
143  }
144 
145  virtual void postProcessBranch(DecompStatus decompStatus) {
146  DippyAlgoMixin::postProcessBranch(this, decompStatus);
147  }
148 
149  virtual void postProcessNode(DecompStatus decompStatus) {
150  DippyAlgoMixin::postProcessNode(this, decompStatus);
151  }
152 
153 };
154 
155 #endif
DippyAlgoPC::postProcessNode
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
Definition: DippyDecompAlgo.h:121
DippyAlgoMixin::m_utilParam
UtilParameters * m_utilParam
Definition: DippyDecompAlgo.h:31
UtilParameters
Definition: UtilParameters.h:26
DecompAlgoPC.h
DippyAlgoC
Python-enabled DecompAlgoC.
Definition: DippyDecompAlgo.h:73
DecompStatus
DecompStatus
Definition: Decomp.h:184
DippyAlgoMixin::getPDownLB
PyObject * getPDownLB()
Definition: DippyDecompAlgo.h:50
DippyAlgoMixin::getPpUpUB
PyObject * getPpUpUB()
Definition: DippyDecompAlgo.h:59
DecompAlgoC.h
DecompAlgoRC
Definition: DecompAlgoRC.h:24
DippyAlgoMixin::m_pProb
PyObject * m_pProb
Definition: DippyDecompAlgo.h:30
DippyAlgoPC::chooseBranchSet
virtual bool chooseBranchSet(std::vector< std::pair< int, double > > &downBranchLB, std::vector< std::pair< int, double > > &downBranchUB, std::vector< std::pair< int, double > > &upBranchLB, std::vector< std::pair< int, double > > &upBranchUB)
Definition: DippyDecompAlgo.h:109
DecompAlgoPC
Class for DECOMP algorithm Price and Cut.
Definition: DecompAlgoPC.h:31
DippyAlgoPC::DippyAlgoPC
DippyAlgoPC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)
Definition: DippyDecompAlgo.h:105
Decomp.h
DippyAlgoMixin::DippyAlgoMixin
DippyAlgoMixin(UtilParameters &utilParam, PyObject *pProb)
Constructor.
Definition: DippyDecompAlgo.h:39
DecompAlgoD.h
DippyAlgoMixin::postProcessBranch
void postProcessBranch(DecompAlgo *algo, DecompStatus decompStatus)
DippyAlgoC::postProcessNode
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
Definition: DippyDecompAlgo.h:93
AlpsDecompTreeNode.h
DippyAlgoRC::postProcessNode
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
Definition: DippyDecompAlgo.h:149
DippyAlgoC::chooseBranchSet
virtual bool chooseBranchSet(std::vector< std::pair< int, double > > &downBranchLB, std::vector< std::pair< int, double > > &downBranchUB, std::vector< std::pair< int, double > > &upBranchLB, std::vector< std::pair< int, double > > &upBranchUB)
Definition: DippyDecompAlgo.h:79
DecompAlgoC
Class for DECOMP algorithm Cutting Plane Method.
Definition: DecompAlgoC.h:33
DippyAlgoC::postProcessBranch
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
Definition: DippyDecompAlgo.h:89
DippyAlgoMixin::postProcessNode
void postProcessNode(DecompAlgo *algo, DecompStatus decompStatus)
DippyAlgoPC::postProcessBranch
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
Definition: DippyDecompAlgo.h:117
DippyAlgoRC::chooseBranchSet
virtual bool chooseBranchSet(std::vector< std::pair< int, double > > &downBranchLB, std::vector< std::pair< int, double > > &downBranchUB, std::vector< std::pair< int, double > > &upBranchLB, std::vector< std::pair< int, double > > &upBranchUB)
Definition: DippyDecompAlgo.h:137
DippyAlgoRC::postProcessBranch
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
Definition: DippyDecompAlgo.h:145
DippyAlgoRC::DippyAlgoRC
DippyAlgoRC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)
Definition: DippyDecompAlgo.h:133
DecompCutPool.h
DippyAlgoMixin::chooseBranchSet
bool chooseBranchSet(DecompAlgo *algo, std::vector< std::pair< int, double > > &downBranchLB, std::vector< std::pair< int, double > > &downBranchUB, std::vector< std::pair< int, double > > &upBranchLB, std::vector< std::pair< int, double > > &upBranchUB)
DippyAlgoC::DippyAlgoC
DippyAlgoC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)
Definition: DippyDecompAlgo.h:75
DippyAlgoRC
Python-enabled DecompAlgoRC.
Definition: DippyDecompAlgo.h:131
DippyAlgoMixin
Mixin class for Dip Algorithms.
Definition: DippyDecompAlgo.h:22
DecompAlgo
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62
DippyAlgoMixin::getPDownUB
PyObject * getPDownUB()
Definition: DippyDecompAlgo.h:53
DecompAlgoRC.h
DippyAlgoMixin::getPUpLB
PyObject * getPUpLB()
Definition: DippyDecompAlgo.h:56
DippyAlgoPC
Python-enabled DecompAlgoPC.
Definition: DippyDecompAlgo.h:103
DecompApp
The main application class.
Definition: DecompApp.h:48