Chen_Han.h
Go to the documentation of this file.
1 // PreviousCH.h: interface for the CChen_Han class.
2 //
4 
5 #pragma once
6 #include "ExactDGPMethod.h"
7 #define _USE_MATH_DEFINES
8 #include <math.h>
9 #include <queue>
10 //#include <minmax.h>
11 #include <iostream>
12 #include "Parameters.h"
13 using namespace std;
14 
15 class CChen_Han : public CExactDGPMethod
16 {
17 protected:
18  struct InfoAtAngle
19  {
20  char birthTime;
21  double disUptodate;
22  double entryProp;
24  {
25  birthTime = -1;
26  disUptodate = DBL_MAX;
27  }
28  };
29  struct Window
30  {
33  bool fDirectParentEdgeOnLeft; //may removed
34  bool fDirectParenIsPseudoSource; //may removed
39  int levelOnSequenceTree;//may removed
40  int indexOfAncestor;//may removed
41  double disToRoot;
42  double proportions[2];
44  pair<double, double> coordOfPseudoSource;
46  {
47  indexOfRootVertex = -1;
48  indexOfCurEdge = -1;
49  indexOfAncestor = -1;
50  }
51  bool Invalid() const
52  {
53  return indexOfRootVertex == -1
54  && indexOfCurEdge == -1
55  && indexOfAncestor == -1;
56  }
57  int GetDirectParentEdge(const CRichModel& model) const
58  {
59  assert(!fDirectParenIsPseudoSource);
60  if (fDirectParentEdgeOnLeft)
61  {
62  return model.Edge(model.Edge(model.Edge(indexOfCurEdge).indexOfReverseEdge).indexOfRightEdge).indexOfReverseEdge;
63  }
64  else
65  {
66  return model.Edge(model.Edge(model.Edge(indexOfCurEdge).indexOfReverseEdge).indexOfLeftEdge).indexOfReverseEdge;
67  }
68  }
69  };//at least 64 bytes.
70  struct QuoteWindow
71  {
73  double disUptodate;
74  bool operator<(const QuoteWindow& another) const
75  {
76  return disUptodate > another.disUptodate;
77  }
78  };
79 protected:
80  queue<QuoteWindow> m_QueueForWindows;
81  queue<QuoteInfoAtVertex> m_QueueForPseudoSources;
82  vector<InfoAtAngle> m_InfoAtAngles;
86 protected:
87  virtual void Initialize();
88  virtual void Dispose();
89  virtual void Propagate();
90  virtual void CollectExperimentalResults();
91 
92  virtual void AddIntoQueueOfPseudoSources(const QuoteInfoAtVertex& quoteOfPseudoSource);
93  virtual void AddIntoQueueOfWindows(QuoteWindow& quoteW);
94  virtual bool UpdateTreeDepthBackWithChoice();
95 
96 protected:
97  bool IsTooNarrowWindow(const Window& w) const;
98  void ComputeChildrenOfPseudoSource(int indexOfParentVertex);
99  void ComputeChildrenOfPseudoSourceFromPseudoSource(int indexOfParentVertex);
100  void ComputeChildrenOfPseudoSourceFromWindow(int indexOfParentVertex);
101  void CreateIntervalChildOfPseudoSource(int source, int subIndexOfIncidentEdge, double propL = 0, double propR = 1);
102  void FillVertChildOfPseudoSource(int source, int subIndexOfVert);
103  void ComputeChildrenOfSource();
104  void ComputeChildrenOfSource(int indexOfSourceVert, double dis);
105  void ComputeTheOnlyLeftChild(const Window& w);
106  void ComputeTheOnlyLeftTrimmedChild(const Window& w);
107  void ComputeLeftTrimmedChildWithParent(const Window& w);
108  void ComputeTheOnlyRightChild(const Window& w);
109  void ComputeTheOnlyRightTrimmedChild(const Window& w);
110  void ComputeRightTrimmedChildWithParent(const Window& w);
111  void ComputeChildrenOfWindow(QuoteWindow& quoteParentWindow);
112 public:
113  CChen_Han(const CRichModel& model, int source);
114  CChen_Han(const CRichModel& model, int source, int destination);
115  CChen_Han(const CRichModel& model, int source, double R);
116  CChen_Han(const CRichModel& model, const map<int, double>& sources);
117  CChen_Han(const CRichModel& model, const map<int, double>& sources, const set<int> &destinations);
118  CChen_Han(const CRichModel& model, const set<int>& sources);
119  CChen_Han(const CRichModel& model, const set<int>& sources, double R);
120  CChen_Han(const CRichModel& model, const set<int>& sources, const set<int>& destinations);
121  __int64 GetTotalNumOfWindows() const{return m_nCountOfWindows;}
122  __int64 GetMaxLenOfWindowQueue() const{return m_nMaxLenOfWindowQueue;}
123  __int64 GetMaxLenOfPseudoSourceQueue() const{return m_nMaxLenOfPseudoSourceQueue;}
124  void OutputExperimentalResults() const;
125 };
pair< double, double > coordOfPseudoSource
Definition: Chen_Han.h:44
bool operator<(const QuoteWindow &another) const
Definition: Chen_Han.h:74
double entryPropOfParent
Definition: Chen_Han.h:43
int indexOfBrachParent
Definition: Chen_Han.h:36
int levelOnSequenceTree
Definition: Chen_Han.h:39
const CEdge & Edge(int edgeIndex) const
Definition: RichModel.cpp:669
bool fDirectParenIsPseudoSource
Definition: Chen_Han.h:34
queue< QuoteInfoAtVertex > m_QueueForPseudoSources
Definition: Chen_Han.h:81
double disToRoot
Definition: Chen_Han.h:41
bool fBrachParentIsPseudoSource
Definition: Chen_Han.h:32
queue< QuoteWindow > m_QueueForWindows
Definition: Chen_Han.h:80
bool fIsOnLeftSubtree
Definition: Chen_Han.h:31
__int64 GetMaxLenOfPseudoSourceQueue() const
Definition: Chen_Han.h:123
int indexOfReverseEdge
Definition: RichModel.h:26
char birthTimeOfParent
Definition: Chen_Han.h:35
bool fDirectParentEdgeOnLeft
Definition: Chen_Han.h:33
__int64 m_nCountOfWindows
Definition: Chen_Han.h:85
bool Invalid() const
Definition: Chen_Han.h:51
int GetDirectParentEdge(const CRichModel &model) const
Definition: Chen_Han.h:57
__int64 GetTotalNumOfWindows() const
Definition: Chen_Han.h:121
__int64 m_nMaxLenOfPseudoSourceQueue
Definition: Chen_Han.h:84
int indexOfRootVertex
Definition: Chen_Han.h:37
vector< InfoAtAngle > m_InfoAtAngles
Definition: Chen_Han.h:82
__int64 GetMaxLenOfWindowQueue() const
Definition: Chen_Han.h:122
#define __int64
__int64 m_nMaxLenOfWindowQueue
Definition: Chen_Han.h:83


co_scan
Author(s):
autogenerated on Mon Feb 28 2022 23:00:39