20#ifndef MINOTAURTRANSSEP_H
21#define MINOTAURTRANSSEP_H
37 typedef CGraph* CGraphPtr;
38 typedef std::deque<CNode *> CNodeQ;
64 void createCG(std::vector<CGraphPtr> * cg, CNodeQ * dq,
int *itnum,
67 bool coeffValue(
CNode * n2,
double *cv,
bool *n,
CNode **n1,
68 std::vector<UInt > *idx);
70 void commonConsCheck(std::vector<double > *constCoeff);
72 void depthFS(
int j,
CNode *n1, std::vector<UInt > * m,
int *itnum, CNodeQ *sNodes,
73 std::deque<int > *sOps, std::vector<CNode *> *sVars,
74 std::vector<CNode *> *sConsts);
79 bool explore(
UInt *j,
CNode *n1, std::vector<UInt > * m,
int opc,
int *itnum,
UInt nvar, CNodeQ *sNodes,
80 std::deque<int > *sOps, std::vector<CNode *> *sVars,
81 std::vector<CNode *> *sConsts);
84 void finalCG(std::vector<CGraphPtr > * cg,
85 CNode **tempN,std::vector<double > *constCoeff,
double *coeff,
86 std::vector<double > *hashVal1,
double *x);
105 void mergeItrInfo(
int mNum, CNodeQ *sNodes, std::deque<int > *sOps,
106 std::vector<CNode *> *sVars,
107 std::vector<CNode *> *sConsts);
110 int mergeItrNum(
int j,
int a, std::vector<UInt > * m);
114 bool sepPartsSearch(
UInt sp, std::vector<CGraphPtr > *nlfnew,
115 std::vector<LinearFunctionPtr > *lfnew,
122 std::stack<int > *candOp,
123 double *coeff,
UInt nnode,
UInt nvar,
double *ub,
129 std::vector<double > *constCoeff,
double *coeff,
130 std::vector<double > *hashVal1,
double *x);
135 bool sepCheck(
double coeff, std::stack<CNode *> *candNodes,
136 std::stack<int > *candOp,
UInt nnode,
UInt nvar,
147 int opc,
int idx, CNodeQ *sNodes,
148 std::deque<int > *sOps,
149 std::vector<CNode *> *sVars,
150 std::vector<CNode *> *sConsts);
162 static const std::string me_;
171 std::vector<CNodeQ > sepNodes_;
176 std::vector< std::deque< int> > sepOps_;
179 std::vector< std::vector< CNode *> > sepVars_;
182 std::vector< std::vector< CNode *> > sepConst_;
184 std::vector<ConstraintPtr> sepCons_;
188 typedef TransSep* TransSepPtr;
189 typedef const TransSep* ConstTransSepPtr;
Declare class CNode to represent node of a computational graph of a nonlinear function.
Get information about a constraint in a given Problem.
Declare abstract base class NonlinearFunction.
Declare the OpCodes used in Minotaur.
Declare important 'types' used in Minotaur.
CNode denotes a node in the computational graph. It stores the op-code, children, parents and other a...
Definition: CNode.h:48
Definition: Environment.h:28
The base class linear function is of the form c'x.
Definition: LinearFunction.h:31
Definition: TransSep.h:40
void createCG(std::vector< CGraphPtr > *cg, CNodeQ *dq, int *itnum, CNode **tempN)
Generate computation graph.
Definition: TransSep.cpp:402
~TransSep()
Destroy.
Definition: TransSep.cpp:58
void depthFS(int j, CNode *n1, std::vector< UInt > *m, int *itnum, CNodeQ *sNodes, std::deque< int > *sOps, std::vector< CNode * > *sVars, std::vector< CNode * > *sConsts)
Perform Depth first search rooted at node n1 at iteration number j.
Definition: TransSep.cpp:474
bool explore(UInt *j, CNode *n1, std::vector< UInt > *m, int opc, int *itnum, UInt nvar, CNodeQ *sNodes, std::deque< int > *sOps, std::vector< CNode * > *sVars, std::vector< CNode * > *sConsts)
Explore further from node n1 at iteration number j.
Definition: TransSep.cpp:554
std::vector< CGraphPtr > sepPartsCGraph(CNodeQ *dq, UInt nnode, std::vector< double > *constCoeff, double *coeff, std::vector< double > *hashVal1, double *x)
Generate computational graph of separable parts.
Definition: TransSep.cpp:1092
void finalCG(std::vector< CGraphPtr > *cg, CNode **tempN, std::vector< double > *constCoeff, double *coeff, std::vector< double > *hashVal1, double *x)
Generate final computation graph.
Definition: TransSep.cpp:702
UInt getNumVars()
Return no. of vars added.
Definition: TransSep.h:93
int mergeItrNum(int j, int a, std::vector< UInt > *m)
Find iteration to merge the current iteration to.
Definition: TransSep.cpp:926
void writeProb()
Write reformulated problem after separability detection.
Definition: TransSep.cpp:1359
bool sepCheck(double coeff, std::stack< CNode * > *candNodes, std::stack< int > *candOp, UInt nnode, UInt nvar, double *ub, LinearFunctionPtr lf)
Definition: TransSep.cpp:1142
void updateVisNodeItr(UInt *j, std::vector< UInt > *m, CNode *n1, int opc, int idx, CNodeQ *sNodes, std::deque< int > *sOps, std::vector< CNode * > *sVars, std::vector< CNode * > *sConsts)
Add information of the node already visited.
Definition: TransSep.cpp:1344
void sepDetection()
Find separability of given problem.
Definition: TransSep.cpp:790
void checkCons()
Definition: TransSep.cpp:85
TransSep()
Default constructor.
Definition: TransSep.cpp:40
void tempPopulate(CNode *n1, std::stack< CNode * > *tempNodes)
Populate initial list for depth first search rooted at node n1.
Definition: TransSep.cpp:1290
bool rootChildren(const CNode *o, std::stack< CNode * > *candNodes, std::stack< int > *candOp, double *coeff, UInt nnode, UInt nvar, double *ub, LinearFunctionPtr lf)
Check whether constraint is separable.
Definition: TransSep.cpp:983
void markVis(UInt i, int *itnum)
Definition: TransSep.cpp:814
void mergeItrInfo(int mNum, CNodeQ *sNodes, std::deque< int > *sOps, std::vector< CNode * > *sVars, std::vector< CNode * > *sConsts)
Merge current iteration with iteration mNum.
Definition: TransSep.cpp:895
Definition: ActiveNodeStore.h:20
unsigned int UInt
Unsigned integer.
Definition: Types.h:30