29 result = dataNode->accept( *
this );
64 if ( State::EVTACCEPTED ==
state || State::EVTREJECTED ==
state ) {
92 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
109 else if ( State::EVTACCEPTED == state )
110 decision = !node.
isLiar();
111 else if ( State::EVTREJECTED == state )
114 if ( -1 != decision ) {
120 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
143 bool foundNonResolvedChild =
false;
144 bool foundNegativeChild =
false;
145 bool foundPositiveChild =
false;
151 if ( childDecision == -1 )
152 foundNonResolvedChild =
true;
153 else if ( childDecision == 1 )
154 foundPositiveChild =
true;
156 foundNegativeChild =
true;
159 if ( node.
m_modeOR && foundPositiveChild ) {
162 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
167 if ( foundNonResolvedChild )
break;
171 if ( !foundNonResolvedChild && decision == -1 ) {
173 if ( foundPositiveChild )
178 if ( foundNegativeChild )
190 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
192 if ( decision != -1 ) {
217 if ( State::INITIAL ==
state ) states.updateState( node.
getAlgoIndex(), State::CONTROLREADY ).ignore();
220 if ( State::CONTROLREADY ==
state ) {
222 result = promoter.visit( node );
239 for (
auto p : products ) rank += p->getConsumers().size();
257 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
264 boost::dynamic_properties dp;
265 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
266 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
267 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
268 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
270 boost::read_graphml( myfile, execPlan, dp );
272 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
275 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
277 auto index =
get( &AlgoTraceProps::m_name, execPlan );
279 runThroughAdjacents( v, execPlan );
280 float rank = m_nodesSucceeded;
294 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
295 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
297 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
298 m_nodesSucceeded += 1;
299 runThroughAdjacents( *itVB, graph );
308 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
314 boost::dynamic_properties dp;
315 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
316 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
317 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
318 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
320 boost::read_graphml( myfile, execPlan, dp );
322 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
325 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
327 auto index =
get( &AlgoTraceProps::m_name, execPlan );
329 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
330 float rank = index_runtime[v];
343 myfile.
open(
"Eccentricity.graphml", std::ios::in );
347 boost::dynamic_properties dp;
353 boost::read_graphml( myfile, execPlan, dp );
355 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
358 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
363 float rank = index_eccentricity[v];
376 recursiveVisit( node );
378 float rank = m_maxKnownDepth;
395 if ( products.empty() )
396 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
398 for (
auto p : products )
399 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
417 bool allChildDecisionsResolved =
true;
426 if ( childDecision == -1 ) {
427 allChildDecisionsResolved =
false;
433 return allChildDecisionsResolved;
454 states.updateState( node.
getAlgoIndex(), State::CONTROLREADY );
455 if ( dataPromoter.visit( node ) ) {
456 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
457 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
463 }
else if ( State::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
464 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
465 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
const unsigned int & getAlgoIndex() const
Get algorithm index.
boost::graph_traits< PrecTrace >::vertex_descriptor AlgoTraceVertex
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.
EventContext * eventContext
Cache for the eventContext.
void setRank(float &rank)
Set Algorithm rank.
bool visit(AlgorithmNode &) override
void recursiveVisit(AlgorithmNode &)
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.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
bool m_allPass
Whether always passing regardless of daughter results.
const std::vector< DecisionNode * > & getParentDecisionHubs() const
Get all parent decision hubs.
bool visit(DecisionNode &) override
bool visit(AlgorithmNode &) override
bool visitEnter(DecisionNode &) const override
bool m_modeOR
Whether acting as "and" (false) or "or" node (true)
bool visit(AlgorithmNode &) override
PrecedenceRulesGraph * m_graph
bool visitEnter(DecisionNode &) const override
std::vector< int > controlFlowState
State of the control flow.
const DataObjID & getPath()
const std::vector< ControlFlowNode * > & getDaughters() const
Get children nodes.
bool visit(AlgorithmNode &) override
void runThroughAdjacents(boost::graph_traits< precedence::PrecTrace >::vertex_descriptor, precedence::PrecTrace)
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, AlgoTraceProps > PrecTrace
virtual bool isValidID(const EventContext &ctx, const DataObjID &id) const =0
check to see if a specific condition object ID is valid for this event
bool m_modePromptDecision
Whether to evaluate the hub decision ASA its child decisions allow to do that.
void addEdgeToPrecTrace(const AlgorithmNode *u, const AlgorithmNode *v)
set cause-effect connection between two algorithms in the precedence trace
bool visit(DecisionNode &) override
bool visit(AlgorithmNode &) override
bool m_inverted
Whether the selection result is negated or not.
bool isLiar() const
Check if control flow logic is always inverted.
bool visit(AlgorithmNode &) override
const std::string & getNodeName() const
Get node name.
const unsigned int & getNodeIndex() const
Get node index.
State
Execution states of the algorithms.
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
SmartIF< ICondSvc > m_condSvc
AlgsExecutionStates::State State
StatusCode updateState(unsigned int iAlgo, State newState)