17 bool allChildDecisionsResolved =
true;
19 int& childDecision = child->m_graph->getNodeDecisions(
m_slotNum)[child->getNodeIndex()];
26 if (childDecision == -1) {
27 allChildDecisionsResolved =
false;
31 if (allChildDecisionsResolved)
34 return allChildDecisionsResolved;
100 bool allChildDecisionsResolved =
true;
102 int& childDecision = child->m_graph->getNodeDecisions(
m_slotNum)[child->getNodeIndex()];
109 if (childDecision == -1) {
110 allChildDecisionsResolved =
false;
114 if (allChildDecisionsResolved)
117 return allChildDecisionsResolved;
159 bool foundNonResolvedChild =
false;
160 bool foundNegativeChild =
false;
161 bool foundPositiveChild =
false;
165 int& childDecision = child->m_graph->getNodeDecisions(
m_slotNum)[child->getNodeIndex()];
167 if (childDecision == -1)
168 foundNonResolvedChild =
true;
169 else if (childDecision == 1)
170 foundPositiveChild =
true;
172 foundNegativeChild =
true;
175 if (node.
m_modeOR && foundPositiveChild) {
178 }
else if (!node.
m_modeOR && foundNegativeChild) {
183 if (foundNonResolvedChild)
188 if (!foundNonResolvedChild && decision == -1) {
190 if (foundPositiveChild) decision = 1;
193 if (foundNegativeChild) decision = 0;
197 if (node.
m_allPass && !foundNonResolvedChild)
200 if (decision != -1) {
241 for (
auto p : products)
242 rank += p->getConsumers().size();
259 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in);
263 boost::dynamic_properties dp;
269 boost::read_graphml(myfile, execPlan, dp);
271 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
273 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
275 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
276 AlgoVertex v = *vp.first;
279 runThroughAdjacents(v,execPlan);
293 typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVB;
294 typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVE;
296 for (boost::tie(itVB, itVE) = adjacent_vertices(vertex, graph); itVB != itVE; ++itVB) {
298 runThroughAdjacents(*itVB, graph);
307 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in);
311 boost::dynamic_properties dp;
317 boost::read_graphml(myfile, execPlan, dp);
319 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
321 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
323 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
324 AlgoVertex v = *vp.first;
328 float rank = index_runtime[v];
340 myfile.
open(
"Eccentricity.graphml", std::ios::in);
344 boost::dynamic_properties dp;
348 boost::read_graphml(myfile, execPlan, dp);
350 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
352 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
354 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
355 AlgoVertex v = *vp.first;
359 float rank = index_eccentricity[v];
371 recursiveVisit(node);
373 float rank = m_maxKnownDepth;
389 if (products.empty())
390 if ( (m_currentDepth - 1) > m_maxKnownDepth)
391 m_maxKnownDepth = m_currentDepth - 1;
393 for (
auto p : products)
394 for (
auto algoNode : p->getConsumers())
395 recursiveVisit(*algoNode);
bool promoteToControlReadyState(const int &slotNum, AlgsExecutionStates &states, std::vector< int > &node_decisions) const override
XXX: CF tests.
const unsigned int & getAlgoIndex() const
XXX: CF tests.
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoNodeStruct > ExecPlan
bool visit(DecisionNode &node) override
bool dataDependenciesSatisfied(const int &slotNum) const
Method to check whether the Algorithm has its all data dependency satisfied.
void setRank(float &rank)
Set Algorithm rank.
void recursiveVisit(AlgorithmNode &node)
Depth-first node parser to calculate node eccentricity (only within the data realm of the precedence ...
const std::vector< DataNode * > & getOutputDataNodes() const
Get all supplier nodes.
bool visit(DecisionNode &) override
bool m_allPass
Whether always passing regardless of daughter results.
bool visit(DecisionNode &) override
std::vector< int > & getNodeDecisions(const int &slotNum) const
bool visit(DecisionNode &node) override
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
bool visitEnter(DecisionNode &node) const override
The AlgsExecutionStates encodes the state machine for the execution of algorithms within a single eve...
PrecedenceRulesGraph * m_graph
const std::vector< ControlFlowNode * > & getDaughters() const
graph_traits< ExecPlan >::vertex_descriptor AlgoVertex
bool visitEnter(DecisionNode &node) const override
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
bool visitLeave(DecisionNode &node) const override
AlgsExecutionStates & getAlgoStates(const int &slotNum) const
bool visit(DecisionNode &) override
void runThroughAdjacents(boost::graph_traits< boost::ExecPlan >::vertex_descriptor vertex, boost::ExecPlan graph)
bool visitEnter(DecisionNode &node) const override
bool visit(DecisionNode &) override
const std::string & getNodeName() const
const unsigned int & getNodeIndex() const
XXX: CF tests.
bool visit(DecisionNode &) override
bool visit(DecisionNode &node) override
bool promoteToDataReadyState(const int &slotNum, const AlgorithmNode *requestor=nullptr) const
StatusCode updateState(unsigned int iAlgo, State newState)