15 result =
visit(*dataNode);
39 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
58 else if ( State::EVTACCEPTED == state )
60 else if ( State::EVTREJECTED == state )
63 if ( -1 != decision ) {
69 for (
auto consumer :
output->getConsumers() )
70 if (State::CONTROLREADY == states[consumer->getAlgoIndex()])
71 consumer->accept(promoter);
94 bool foundNonResolvedChild =
false;
95 bool foundNegativeChild =
false;
96 bool foundPositiveChild =
false;
102 if (childDecision == -1)
103 foundNonResolvedChild =
true;
104 else if (childDecision == 1)
105 foundPositiveChild =
true;
107 foundNegativeChild =
true;
110 if (node.
m_modeOR && foundPositiveChild) {
113 }
else if (!node.
m_modeOR && foundNegativeChild) {
118 if (foundNonResolvedChild)
123 if (!foundNonResolvedChild && decision == -1) {
125 if (foundPositiveChild) decision = 1;
128 if (foundNegativeChild) decision = 0;
133 if (node.
m_allPass && !foundNonResolvedChild)
136 if (decision != -1) {
160 if ( State::INITIAL ==
state )
161 states.updateState( node.
getAlgoIndex(), State::CONTROLREADY ).ignore();
164 if ( State::CONTROLREADY ==
state ) {
166 result = promoter.visit(node);
182 for (
auto p : products)
183 rank += p->getConsumers().size();
200 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in);
204 boost::dynamic_properties dp;
210 boost::read_graphml(myfile, execPlan, dp);
212 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
214 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
216 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
217 AlgoVertex v = *vp.first;
220 runThroughAdjacents(v,execPlan);
234 typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVB;
235 typename boost::graph_traits<boost::ExecPlan>::adjacency_iterator itVE;
237 for (boost::tie(itVB, itVE) = adjacent_vertices(vertex, graph); itVB != itVE; ++itVB) {
239 runThroughAdjacents(*itVB, graph);
248 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in);
252 boost::dynamic_properties dp;
258 boost::read_graphml(myfile, execPlan, dp);
260 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
262 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
264 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
265 AlgoVertex v = *vp.first;
269 float rank = index_runtime[v];
281 myfile.
open(
"Eccentricity.graphml", std::ios::in);
285 boost::dynamic_properties dp;
289 boost::read_graphml(myfile, execPlan, dp);
291 typedef boost::graph_traits<boost::ExecPlan>::vertex_iterator itV;
293 typedef boost::graph_traits<boost::ExecPlan>::vertex_descriptor
AlgoVertex;
295 for (vp = boost::vertices(execPlan); vp.first != vp.second; ++vp.first) {
296 AlgoVertex v = *vp.first;
300 float rank = index_eccentricity[v];
312 recursiveVisit(node);
314 float rank = m_maxKnownDepth;
330 if (products.empty())
331 if ( (m_currentDepth - 1) > m_maxKnownDepth)
332 m_maxKnownDepth = m_currentDepth - 1;
334 for (
auto p : products)
335 for (
auto algoNode : p->getConsumers())
336 recursiveVisit(*algoNode);
354 bool allChildDecisionsResolved =
true;
363 if (childDecision == -1) {
364 allChildDecisionsResolved =
false;
368 if (allChildDecisionsResolved)
371 return allChildDecisionsResolved;
391 states.updateState(node.
getAlgoIndex(), State::CONTROLREADY);
392 if (dataPromoter.visit(node)) {
393 states.updateState(node.
getAlgoIndex(), State::SCHEDULED);
394 states.updateState(node.
getAlgoIndex(), State::EVTACCEPTED);
400 }
else if (State::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit(node)) {
401 states.updateState(node.
getAlgoIndex(), State::SCHEDULED);
402 states.updateState(node.
getAlgoIndex(), State::EVTACCEPTED);
const unsigned int & getAlgoIndex() const
XXX: CF tests.
bool visit(AlgorithmNode &node) override
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoNodeStruct > ExecPlan
const std::vector< DataNode * > & getInputDataNodes() const
Get all consumer nodes.
bool isOptimist() const
Check if positive control flow decision is enforced.
AlgsExecutionStates algsStates
Vector of algorithms states.
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(AlgorithmNode &node) override
bool m_allPass
Whether always passing regardless of daughter results.
const std::vector< DecisionNode * > & getParentDecisionHubs() const
Get all parent decision hubs.
bool visit(DecisionNode &node) override
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
bool visitEnter(DecisionNode &node) const override
std::vector< int > controlFlowState
State of the control flow.
const std::vector< ControlFlowNode * > & getDaughters() const
graph_traits< ExecPlan >::vertex_descriptor AlgoVertex
bool visit(AlgorithmNode &node) override
bool visit(AlgorithmNode &node) override
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
void runThroughAdjacents(boost::graph_traits< boost::ExecPlan >::vertex_descriptor vertex, boost::ExecPlan graph)
bool visitEnter(DecisionNode &node) const override
bool isLiar() const
Check if control flow logic is always inverted.
const std::string & getNodeName() const
const unsigned int & getNodeIndex() const
XXX: CF tests.
State
Execution states of the algorithms.
bool visit(AlgorithmNode &node) override
bool visit(AlgorithmNode &node) override
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
bool visit(DecisionNode &node) override
AlgsExecutionStates::State State
StatusCode updateState(unsigned int iAlgo, State newState)