27 result = dataNode->accept( *
this );
58 for (
auto algoNode : producers ) {
60 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
67 for (
auto algoNode : producers ) {
69 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
95 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
111 else if ( AState::EVTACCEPTED == state )
112 decision = !node.
isLiar();
113 else if ( AState::EVTREJECTED == state )
116 if ( -1 != decision ) {
122 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
138 bool canFindExit =
false;
140 allAncestors.
push( &node );
141 while ( allAncestors.
size() ) {
155 for (
auto& evenOlder : thisAncestor->
m_parents ) { allAncestors.
push( evenOlder ); }
160 if ( !canFindExit )
return false;
170 bool foundNonResolvedChild =
false;
171 bool foundNegativeChild =
false;
172 bool foundPositiveChild =
false;
185 bool breakout =
false;
186 for (
unsigned int slotIndex : searchResult->second ) {
195 if ( childDecision == -1 )
196 foundNonResolvedChild =
true;
197 else if ( childDecision == 1 )
198 foundPositiveChild =
true;
200 foundNegativeChild =
true;
203 if ( node.
m_modeOR && foundPositiveChild ) {
207 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
213 if ( foundNonResolvedChild ) {
222 if ( breakout )
break;
228 if ( childDecision == -1 )
229 foundNonResolvedChild =
true;
230 else if ( childDecision == 1 )
231 foundPositiveChild =
true;
233 foundNegativeChild =
true;
236 if ( node.
m_modeOR && foundPositiveChild ) {
239 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
244 if ( foundNonResolvedChild )
break;
249 if ( !foundNonResolvedChild && decision == -1 ) {
251 if ( foundPositiveChild )
256 if ( foundNegativeChild )
268 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
270 if ( decision != -1 ) {
274 for (
auto parent : node.
m_parents ) { parent->accept( *
this ); }
276 if ( oldSlot )
m_slot = oldSlot;
283 for (
unsigned int slotIndex : searchResult->second ) {
289 bool result = child->accept( *
this );
299 bool result = child->accept( *
this );
305 if ( oldSlot )
m_slot = oldSlot;
325 if ( AState::INITIAL ==
state ) states.set( node.
getAlgoIndex(), AState::CONTROLREADY ).ignore();
328 if ( AState::CONTROLREADY ==
state ) {
330 result = promoter.visit( node );
346 for (
auto p : products ) rank += p->getConsumers().size();
363 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
370 boost::dynamic_properties dp;
371 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
372 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
373 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
374 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
376 boost::read_graphml( myfile, execPlan, dp );
378 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
381 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
383 auto index =
get( &AlgoTraceProps::m_name, execPlan );
385 runThroughAdjacents( v, execPlan );
386 float rank = m_nodesSucceeded;
399 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
400 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
402 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
403 m_nodesSucceeded += 1;
404 runThroughAdjacents( *itVB, graph );
412 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
418 boost::dynamic_properties dp;
419 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
420 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
421 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
422 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
424 boost::read_graphml( myfile, execPlan, dp );
426 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
429 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
431 auto index =
get( &AlgoTraceProps::m_name, execPlan );
433 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
434 float rank = index_runtime[v];
446 myfile.
open(
"Eccentricity.graphml", std::ios::in );
450 boost::dynamic_properties dp;
456 boost::read_graphml( myfile, execPlan, dp );
458 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
461 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
466 float rank = index_eccentricity[v];
478 recursiveVisit( node );
480 float rank = m_maxKnownDepth;
496 if ( products.empty() )
497 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
499 for (
auto p : products )
500 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
515 bool allChildDecisionsResolved =
true;
519 child->accept( *
this );
522 if ( childDecision == -1 ) allChildDecisionsResolved =
false;
531 for (
auto parent : node.
m_parents ) { parent->accept( *
this ); }
536 if ( allChildDecisionsResolved ) {
540 for (
auto parent : node.
m_parents ) { parent->accept( *
this ); }
543 return allChildDecisionsResolved;
562 states.set( node.
getAlgoIndex(), AState::CONTROLREADY );
563 if ( dataPromoter.visit( node ) ) {
571 }
else if ( AState::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
const unsigned int & getAlgoIndex() const
Get algorithm index.
std::string entryPoint
Event Views bookkeeping (TODO: optimize view bookkeeping)
Class representing an event slot.
std::vector< DecisionNode * > m_parents
Direct parent nodes.
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.
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.
std::vector< int > controlFlowState
State of the control flow.
std::vector< EventSlot > allSubSlots
Actual sub-slot instances.
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
const DataObjID & getPath()
const std::vector< ControlFlowNode * > & getDaughters() const
Get children nodes.
StatusCode set(unsigned int iAlgo, State newState)
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
State
Execution states of the algorithms.
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 m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
EventSlot * parentSlot
Pointer to parent slot (null for top level)
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.
std::unordered_map< std::string, std::vector< unsigned int > > subSlotsByNode
Listing of sub-slots by the node (name) they are attached to.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
std::unique_ptr< EventContext > eventContext
Cache for the eventContext.
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
AlgsExecutionStates algsStates
Vector of algorithms states.
SmartIF< ICondSvc > m_condSvc