Dip 0.95.0
Loading...
Searching...
No Matches
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
23private:
24 PyObject* pDownLB;
25 PyObject* pDownUB;
26 PyObject* pUpLB;
27 PyObject* pUpUB;
28
29protected:
30 PyObject* m_pProb;
32public:
39 DippyAlgoMixin(UtilParameters& utilParam, PyObject* pProb)
40 : pDownLB(NULL), pDownUB(NULL), pUpLB(NULL), pUpUB(NULL),
41 m_pProb(pProb), m_utilParam(&utilParam) {
42 }
43
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
73class DippyAlgoC : DippyAlgoMixin, public DecompAlgoC {
74public:
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
104public:
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
131class DippyAlgoRC : DippyAlgoMixin, public DecompAlgoRC {
132public:
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
DecompStatus
Definition Decomp.h:184
DecompAlgoPC(DecompApp *app, UtilParameters &utilParam, bool doSetup=true, const DecompAlgoType algo=PRICE_AND_CUT)
Default constructors.
Base class for DECOMP algorithms.
Definition DecompAlgo.h:62
The main application class.
Definition DecompApp.h:48
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)
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
DippyAlgoC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)
void postProcessBranch(DecompAlgo *algo, DecompStatus decompStatus)
UtilParameters * m_utilParam
PyObject * getPDownLB()
PyObject * getPUpLB()
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)
PyObject * getPDownUB()
PyObject * getPpUpUB()
void postProcessNode(DecompAlgo *algo, DecompStatus decompStatus)
DippyAlgoMixin(UtilParameters &utilParam, PyObject *pProb)
Constructor.
PyObject * m_pProb
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
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)
DippyAlgoPC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)
virtual void postProcessBranch(DecompStatus decompStatus)
Do some information sending after the current node has been branched.
virtual void postProcessNode(DecompStatus decompStatus)
Do some information sending after the current node has been processed.
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)
DippyAlgoRC(DecompApp *app, UtilParameters &utilParam, PyObject *pProb)