1#ifndef BPMNOS_Execution_SeededController_H
2#define BPMNOS_Execution_SeededController_H
17#include <unordered_map>
39 bool setSeed(
const std::vector<size_t> initialSeed);
54 std::unordered_map< const Vertex*, const Vertex* >
performing;
57 template <
class T1,
class T2>
59 auto h1 = std::hash<T1>{}(p.first);
60 auto h2 = std::hash<T2>{}(p.second);
65 return h1 ^ (h2 * 2654435761u);
Base class for an execution controller which dispatches events to the engine and listens to notificat...
Represents an abstract base class for an evaluator determining feasibility and reward of a decision.
Represents a graph containing all BPMN nodes that may receive a token during execution of a scenario.
const Vertex * exit(const Vertex *vertex) const
const Vertex * entry(const Vertex *vertex) const
A controller dispatching decisions in the order derived from a given seed.
std::list< constVertex * >::iterator finalizeUnvisitedTypedStartEvents(std::list< const Vertex * >::iterator it)
bool withdrawableEntry(const BPMN::Node *node) const
Method finalizing the sequence position of a unvisited vertices belonging to typed start events.
void synchronizeSolution(const Token *token)
static Config default_config()
const FlattenedGraph * flattenedGraph
const Vertex * entry(const Vertex *vertex) const
Method creating a message delivery event.
virtual std::shared_ptr< Event > createChoiceEvent(const SystemState *systemState, const Token *token, const Vertex *vertex)=0
Method creating a choice event.
virtual std::shared_ptr< Event > createExitEvent(const SystemState *systemState, const Token *token, const Vertex *vertex)=0
Method creating a choice event.
void finalizePredecessorPositions(const Vertex *vertex)
std::list< const Vertex * > pendingVertices
void initializePendingVertices()
Method returning the number of processed vertices.
void fetchPendingPredecessors(std::unordered_set< const Vertex * > &predecessors, const Vertex *vertex) const
bool setSeed(const std::vector< size_t > initialSeed)
size_t getProgress() const
Method providing the vertex sequence in the solution.
void notice(const Observable *observable) override
void subscribe(Engine *engine)
std::unordered_map< const Vertex *, const Vertex * > performing
std::vector< size_t > getSequence() const
Method return true if a token entering a catch event node may be withdrawn.
std::shared_ptr< Event > dispatchEvent(const SystemState *systemState)
virtual std::shared_ptr< Event > createEntryEvent(const SystemState *systemState, const Token *token, const Vertex *vertex)=0
Method creating an initial sequence of vertices.
bool hasPendingRecipient(const Vertex *vertex) const
std::vector< size_t > seed
std::shared_ptr< TerminationEvent > terminationEvent
void connect(Mediator *mediator)
std::list< const Vertex * > processedVertices
The list of vertices to be processed.
const Vertex * exit(const Vertex *vertex) const
std::list< constVertex * >::iterator finalizeVertexPosition(const Vertex *vertex)
std::list< constVertex * >::iterator finalizeUnvisited(const Vertex *vertex)
Method finalizing the sequence position of a pending vertex and removing it from the list.
void finalizeUnvisitedChildren(const Vertex *vertex)
SeededController(const BPMNOS::Execution::FlattenedGraph *flattenedGraph, Config config=default_config())
virtual std::shared_ptr< Event > createMessageDeliveryEvent(const SystemState *systemState, const Token *token, const Vertex *vertex)=0
Method creating a choice event.
bool hasPendingPredecessor(const Vertex *vertex) const
The list of vertices already processed.
A class representing the state that the execution or simulation of a given scenario is in.
Represents a token running through a (sub)process.
Base class for all nodes in a BPMN model.
Map holding the entry vertex of a sequential activity performed by a sequential performer.
std::size_t operator()(const std::pair< T1, T2 > &p) const