BPMN-OS
BPMN for optimization and simulation
Loading...
Searching...
No Matches
CPController.h
Go to the documentation of this file.
1#ifndef BPMNOS_Execution_CPController_H
2#define BPMNOS_Execution_CPController_H
3
4#ifdef USE_CP
5
6#include <bpmn++.h>
7#include "SeededController.h"
11#include <cp/solver.h>
12
13namespace BPMNOS::Execution {
14
15/**
16 * @brief A controller dispatching the best decisions obtained from a CP solution
17 */
18class CPController : public SeededController {
19public:
20 CPController(const BPMNOS::Execution::FlattenedGraph* flattenedGraph);
21
22 void setSolution(CP::Solution solution);
23
24 void notice(const Observable* observable) override;
25 std::shared_ptr<Event> createEntryEvent(const SystemState* systemState, const Token* token, const Vertex* vertex) override;
26 std::shared_ptr<Event> createExitEvent(const SystemState* systemState, const Token* token, const Vertex* vertex) override;
27 std::shared_ptr<Event> createChoiceEvent(const SystemState* systemState, const Token* token, const Vertex* vertex) override;
28 std::shared_ptr<Event> createMessageDeliveryEvent(const SystemState* systemState, const Token* token, const Vertex* vertex) override;
29
30 CPModel constraintProgramm;
31
32protected:
33 std::unique_ptr<CP::Solution> solution;
34 auto_list< std::weak_ptr<const Message>, const Vertex* > messages;
35
36 bool isVisited(const Vertex* vertex) const;
37 BPMNOS::number getTimestamp(const Vertex* vertex) const;
38
39private:
40 void initializeFromSolution();
41};
42
43} // namespace BPMNOS::Execution
44
45#endif // USE_CP
46
47#endif // BPMNOS_Execution_CPController_H
48
Represents a graph containing all BPMN nodes that may receive a token during execution of a scenario.
BPMNOS_NUMBER_TYPE number
Definition Number.h:50