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 )
185 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
187 if ( decision != -1 ) {
212 if ( State::INITIAL ==
state ) states.updateState( node.
getAlgoIndex(), State::CONTROLREADY ).ignore();
215 if ( State::CONTROLREADY ==
state ) {
217 result = promoter.visit( node );
234 for (
auto p : products ) rank += p->getConsumers().size();
252 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
259 boost::dynamic_properties dp;
260 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
261 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
262 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
263 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
265 boost::read_graphml( myfile, execPlan, dp );
267 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
270 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
272 auto index =
get( &AlgoTraceProps::m_name, execPlan );
274 runThroughAdjacents( v, execPlan );
275 float rank = m_nodesSucceeded;
289 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
290 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
292 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
293 m_nodesSucceeded += 1;
294 runThroughAdjacents( *itVB, graph );
303 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
309 boost::dynamic_properties dp;
310 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
311 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
312 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
313 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
315 boost::read_graphml( myfile, execPlan, dp );
317 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
320 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
322 auto index =
get( &AlgoTraceProps::m_name, execPlan );
324 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
325 float rank = index_runtime[v];
338 myfile.
open(
"Eccentricity.graphml", std::ios::in );
342 boost::dynamic_properties dp;
348 boost::read_graphml( myfile, execPlan, dp );
350 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
353 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
358 float rank = index_eccentricity[v];
371 recursiveVisit( node );
373 float rank = m_maxKnownDepth;
390 if ( products.empty() )
391 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
393 for (
auto p : products )
394 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
412 bool allChildDecisionsResolved =
true;
421 if ( childDecision == -1 ) {
422 allChildDecisionsResolved =
false;
428 return allChildDecisionsResolved;
449 states.updateState( node.
getAlgoIndex(), State::CONTROLREADY );
450 if ( dataPromoter.visit( node ) ) {
451 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
452 states.updateState( node.
getAlgoIndex(), State::EVTACCEPTED );
458 }
else if ( State::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
459 states.updateState( node.
getAlgoIndex(), State::SCHEDULED );
460 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 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)