Belle II Software
release-08-01-10
|
General implementation of a tree search algorithm using a given classes as state and results and one strategy class to decide, which child states should be traversed next. More...
#include <WeightedTreeTraversal.h>
Public Types | |
using | IOTypes = std::tuple< AIOTypes... > |
Types that should be served to apply on invokation. | |
using | IOVectors = std::tuple< std::vector< AIOTypes >... > |
Vector types that should be served to apply on invokation. | |
Public Member Functions | |
WeightedTreeTraversal () | |
Construct this findlet and add the subfindlet as listener. | |
void | exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final |
Expose the parameters of the subfindlet. | |
void | apply (const std::vector< const AState * > &seededStates, const std::vector< WeightedRelation< AState >> &stateRelations, std::vector< AResult > &results) override |
Main function of this findlet: traverse a tree starting from a given seed states. More... | |
virtual std::string | getDescription () |
Brief description of the purpose of the concret findlet. | |
virtual void | apply (ToVector< AIOTypes > &... ioVectors)=0 |
Main function executing the algorithm. | |
void | initialize () override |
Receive and dispatch signal before the start of the event processing. | |
void | beginRun () override |
Receive and dispatch signal for the beginning of a new run. | |
void | beginEvent () override |
Receive and dispatch signal for the start of a new event. | |
void | endRun () override |
Receive and dispatch signal for the end of the run. | |
void | terminate () override |
Receive and dispatch Signal for termination of the event processing. | |
Protected Types | |
using | ToVector = typename ToVectorImpl< T >::Type |
Short hand for ToRangeImpl. | |
Protected Member Functions | |
void | addProcessingSignalListener (ProcessingSignalListener *psl) |
Register a processing signal listener to be notified. | |
int | getNProcessingSignalListener () |
Get the number of currently registered listeners. | |
Private Types | |
using | Super = Findlet< const AState *const, const WeightedRelation< AState >, AResult > |
Parent class. | |
Private Member Functions | |
void | traverseTree (std::vector< const AState * > &path, const std::vector< WeightedRelation< AState >> &stateRelations, std::vector< AResult > &results) |
Implementation of the traverseTree function. | |
Private Attributes | |
AStateRejecter | m_stateRejecter |
State rejecter to decide which available continuations should be traversed next. | |
std::vector< ProcessingSignalListener * > | m_subordinaryProcessingSignalListeners |
References to subordinary signal processing listener contained in this findlet. | |
bool | m_initialized = false |
Flag to keep track whether initialization happend before. | |
bool | m_terminated = false |
Flag to keep track whether termination happend before. | |
std::string | m_initializedAs |
Name of the type during initialisation. | |
General implementation of a tree search algorithm using a given classes as state and results and one strategy class to decide, which child states should be traversed next.
Requirements for the template parameters:
AStateRejecter: Should be roughly of type Findlet<const AState* const, WithWeight<AState*> > with an apply methode like:
apply(const std::vector<const AState*>& currentPath, std::vector<WithWeight<AState*> >& nextStates);
Therefore it receives the current path and a list of potential next states with an apriori Weight, that it should sort out for viable continuations to traverse next.
The StateRejecter is allowed to adjust the nextStates for book keeping purposes, but should generally avoid to adjust the states in the currentPath to not interfere with the traversal of earlier siblings.
Definition at line 52 of file WeightedTreeTraversal.h.
|
override |
Main function of this findlet: traverse a tree starting from a given seed states.
ATTENTION: As described above, the states themselves can be altered during the tree traversal.
Definition at line 94 of file WeightedTreeTraversal.h.