30 result = dataNode->accept( *
this );
62 for (
auto algoNode : producers ) {
64 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
71 for (
auto algoNode : producers ) {
73 if ( AState::EVTACCEPTED ==
state || AState::EVTREJECTED ==
state ) {
101 for (
auto condAlg : node.
getProducers() ) condAlg->accept( promoter );
118 else if ( AState::EVTACCEPTED == state )
119 decision = !node.
isLiar();
120 else if ( AState::EVTREJECTED == state )
123 if ( -1 != decision ) {
129 for (
auto& consumer :
output->getConsumers() ) consumer->accept( promoter );
146 bool canFindExit =
false;
148 allAncestors.
push( &node );
149 while ( allAncestors.
size() ) {
163 for (
auto& evenOlder : thisAncestor->
m_parents ) {
165 allAncestors.
push( evenOlder );
171 if ( !canFindExit )
return false;
182 bool foundNonResolvedChild =
false;
183 bool foundNegativeChild =
false;
184 bool foundPositiveChild =
false;
197 bool breakout =
false;
198 for (
unsigned int slotIndex : searchResult->second ) {
207 if ( childDecision == -1 )
208 foundNonResolvedChild =
true;
209 else if ( childDecision == 1 )
210 foundPositiveChild =
true;
212 foundNegativeChild =
true;
215 if ( node.
m_modeOR && foundPositiveChild ) {
219 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
225 if ( foundNonResolvedChild ) {
234 if ( breakout )
break;
240 if ( childDecision == -1 )
241 foundNonResolvedChild =
true;
242 else if ( childDecision == 1 )
243 foundPositiveChild =
true;
245 foundNegativeChild =
true;
248 if ( node.
m_modeOR && foundPositiveChild ) {
251 }
else if ( !node.
m_modeOR && foundNegativeChild ) {
256 if ( foundNonResolvedChild )
break;
261 if ( !foundNonResolvedChild && decision == -1 ) {
263 if ( foundPositiveChild )
268 if ( foundNegativeChild )
280 if ( node.
m_allPass && !foundNonResolvedChild ) decision = 1;
282 if ( decision != -1 ) {
287 parent->accept( *
this );
290 if ( oldSlot )
m_slot = oldSlot;
297 for (
unsigned int slotIndex : searchResult->second ) {
303 bool result = child->accept( *
this );
313 bool result = child->accept( *
this );
319 if ( oldSlot )
m_slot = oldSlot;
341 if ( AState::INITIAL ==
state ) states.set( node.
getAlgoIndex(), AState::CONTROLREADY ).ignore();
344 if ( AState::CONTROLREADY ==
state ) {
346 result = promoter.visit( node );
363 for (
auto p : products ) rank += p->getConsumers().size();
381 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
388 boost::dynamic_properties dp;
389 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
390 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
391 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
392 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
394 boost::read_graphml( myfile, execPlan, dp );
396 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
399 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
401 auto index =
get( &AlgoTraceProps::m_name, execPlan );
403 runThroughAdjacents( v, execPlan );
404 float rank = m_nodesSucceeded;
418 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVB;
419 typename boost::graph_traits<precedence::PrecTrace>::adjacency_iterator itVE;
421 for ( boost::tie( itVB, itVE ) = adjacent_vertices( vertex, graph ); itVB != itVE; ++itVB ) {
422 m_nodesSucceeded += 1;
423 runThroughAdjacents( *itVB, graph );
432 myfile.
open(
"InputExecutionPlan.graphml", std::ios::in );
438 boost::dynamic_properties dp;
439 dp.property(
"name",
get( &AlgoTraceProps::m_name, execPlan ) );
440 dp.property(
"index",
get( &AlgoTraceProps::m_index, execPlan ) );
441 dp.property(
"dataRank",
get( &AlgoTraceProps::m_rank, execPlan ) );
442 dp.property(
"runtime",
get( &AlgoTraceProps::m_runtime, execPlan ) );
444 boost::read_graphml( myfile, execPlan, dp );
446 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
449 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
451 auto index =
get( &AlgoTraceProps::m_name, execPlan );
453 auto index_runtime =
get( &AlgoTraceProps::m_runtime, execPlan );
454 float rank = index_runtime[v];
467 myfile.
open(
"Eccentricity.graphml", std::ios::in );
471 boost::dynamic_properties dp;
477 boost::read_graphml( myfile, execPlan, dp );
479 typedef boost::graph_traits<precedence::PrecTrace>::vertex_iterator itV;
482 for ( vp = boost::vertices( execPlan ); vp.first != vp.second; ++vp.first ) {
487 float rank = index_eccentricity[v];
500 recursiveVisit( node );
502 float rank = m_maxKnownDepth;
519 if ( products.empty() )
520 if ( ( m_currentDepth - 1 ) > m_maxKnownDepth ) m_maxKnownDepth = m_currentDepth - 1;
522 for (
auto p : products )
523 for (
auto algoNode : p->getConsumers() ) recursiveVisit( *algoNode );
540 bool allChildDecisionsResolved =
true;
544 child->accept( *
this );
547 if ( childDecision == -1 ) allChildDecisionsResolved =
false;
557 parent->accept( *
this );
563 if ( allChildDecisionsResolved ) {
568 parent->accept( *
this );
572 return allChildDecisionsResolved;
593 states.set( node.
getAlgoIndex(), AState::CONTROLREADY );
594 if ( dataPromoter.visit( node ) ) {
602 }
else if ( AState::CONTROLREADY == states[node.
getAlgoIndex()] && dataPromoter.visit( node ) ) {
const unsigned int & getAlgoIndex() const
Get algorithm index.
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.
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.
bool m_allPass
Whether always passing regardless of daughter results.
std::string entryPoint
Name of the node this slot is attached to ("" for top level)
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.
StatusCode set(unsigned int iAlgo, State newState)
bool visit(AlgorithmNode &) override
void runThroughAdjacents(boost::graph_traits< precedence::PrecTrace >::vertex_descriptor, precedence::PrecTrace)
EventSlot * parentSlot
Pointer to parent slot (null for top level)
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.
std::map< std::string, std::vector< unsigned int > > subSlotsByNode
Listing of sub-slots by the node (name) they are attached to.
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
std::vector< EventSlot > allSubSlots
Actual sub-slot instances.
bool m_modeConcurrent
Whether all daughters will be evaluated concurrently or sequentially.
Class representing the event slot.
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.
AlgorithmNode * getAlgorithmNode(const std::string &algoName) const
Get the AlgorithmNode from by algorithm name using graph index.
const std::vector< AlgorithmNode * > & getProducers() const
Get all data object producers.
SmartIF< ICondSvc > m_condSvc