BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
GreedyDispatcher.h
Go to the documentation of this file.
1#ifndef BPMNOS_Execution_GreedyDispatcher_H
2#define BPMNOS_Execution_GreedyDispatcher_H
3
4#include <bpmn++.h>
5#include "Evaluator.h"
9#include "Decision.h"
10
11namespace BPMNOS::Execution {
12
13/**
14 * @brief Class for dispatching the event with the best evaluation.
15 */
16// WeakPtrs... are < std::weak_ptr<const Token>, std::weak_ptr<const DecisionRequest> >
17template <typename... WeakPtrs>
19public:
21 virtual ~GreedyDispatcher() = default;
22 std::shared_ptr<Event> dispatchEvent( const SystemState* systemState ) override;
23 void connect(Mediator* mediator) override;
24 void notice(const Observable* observable) override;
26protected:
28 auto_list< WeakPtrs..., std::shared_ptr<Decision> > decisionsWithoutEvaluation;
29
30 void addEvaluation(WeakPtrs..., std::shared_ptr<Decision> decision, std::optional<double> reward );
31
32 auto_set< double, WeakPtrs..., std::weak_ptr<Event> > evaluatedDecisions;
33 virtual void dataUpdate(const DataUpdate* update);
34 bool intersect(const std::vector<const BPMNOS::Model::Attribute*>& first, const std::set<const BPMNOS::Model::Attribute*>& second) const;
35 void removeObsolete(const DataUpdate* update, auto_list< WeakPtrs..., std::shared_ptr<Decision> >& evaluation, auto_list< WeakPtrs..., std::shared_ptr<Decision> >& unevaluatedDecisions);
36 void removeDependentEvaluations(const DataUpdate* update, std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr<Decision> > >& evaluatedDecisions, auto_list< WeakPtrs..., std::shared_ptr<Decision> >& unevaluatedDecisions);
37
38 auto_list< WeakPtrs..., std::shared_ptr<Decision> > invariantEvaluations;
39 auto_list< WeakPtrs..., std::shared_ptr<Decision> > timeDependentEvaluations;
40 std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr<Decision> > > dataDependentEvaluations;
41 std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr<Decision> > > timeAndDataDependentEvaluations;
42 void clockTick();
43};
44
45} // namespace BPMNOS::Execution
46
47#endif // BPMNOS_Execution_GreedyDispatcher_H
48
Represents an abstract base class for a pending Evaluator.
Definition Evaluator.h:15
Class for dispatching the event with the best evaluation.
auto_list< WeakPtrs..., std::shared_ptr< Decision > > invariantEvaluations
std::shared_ptr< Event > dispatchEvent(const SystemState *systemState) override
virtual void dataUpdate(const DataUpdate *update)
std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr< Decision > > > timeAndDataDependentEvaluations
std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr< Decision > > > dataDependentEvaluations
auto_list< WeakPtrs..., std::shared_ptr< Decision > > timeDependentEvaluations
void removeDependentEvaluations(const DataUpdate *update, std::unordered_map< long unsigned int, auto_list< WeakPtrs..., std::shared_ptr< Decision > > > &evaluatedDecisions, auto_list< WeakPtrs..., std::shared_ptr< Decision > > &unevaluatedDecisions)
void addEvaluation(WeakPtrs..., std::shared_ptr< Decision > decision, std::optional< double > reward)
void notice(const Observable *observable) override
void connect(Mediator *mediator) override
auto_set< double, WeakPtrs..., std::weak_ptr< Event > > evaluatedDecisions
auto_list< WeakPtrs..., std::shared_ptr< Decision > > decisionsWithoutEvaluation
void removeObsolete(const DataUpdate *update, auto_list< WeakPtrs..., std::shared_ptr< Decision > > &evaluation, auto_list< WeakPtrs..., std::shared_ptr< Decision > > &unevaluatedDecisions)
bool intersect(const std::vector< const BPMNOS::Model::Attribute * > &first, const std::set< const BPMNOS::Model::Attribute * > &second) const
A class representing the state that the execution or simulation of a given scenario is in.
Definition SystemState.h:21
List of tuples with automatic removal of tuples containing an expired weak_ptr.
Definition auto_list.h:15
Set of tuples ordered in increasing order of the first component with automatic removal of tuples con...
Definition auto_set.h:15
BPMNOS_NUMBER_TYPE number
Definition Number.h:42
Represents an abstract base class for a class that is an event listener and notifier.
Definition Mediator.h:13