Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
runner.h
Go to the documentation of this file.
1#pragma once
2#include "event_aggregator.h"
3#include "simulation.h"
4
5#include <atomic>
6#include <functional>
7#include <memory>
8#include <stop_token>
9
10namespace hgps {
11
24class Runner {
25 public:
26 Runner() = delete;
27
31 Runner(std::shared_ptr<EventAggregator> bus,
32 std::unique_ptr<RandomBitGenerator> seed_generator) noexcept;
33
39 double run(Simulation &baseline, const unsigned int trial_runs);
40
47 double run(Simulation &baseline, Simulation &intervention, const unsigned int trial_runs);
48
51 bool is_running() const noexcept;
52
54 void cancel() noexcept;
55
56 private:
57 std::atomic<bool> running_;
58 std::shared_ptr<EventAggregator> event_bus_;
59 std::unique_ptr<RandomBitGenerator> seed_generator_;
60 std::stop_source source_;
61 std::string runner_id_{};
62
63 void run_model_thread(const std::stop_token &token, Simulation &model, unsigned int run,
64 unsigned int seed);
65
66 void notify(std::unique_ptr<hgps::EventMessage> message);
67};
68
69} // namespace hgps
Defines the event aggregator interface type.
Definition event_aggregator.h:59
Pseudo-random number generator algorithm interface.
Definition randombit_generator.h:9
Defines the simulation executive data type class.
Definition runner.h:24
void cancel() noexcept
Cancel a running experiment.
Definition runner.cpp:108
bool is_running() const noexcept
Gets a value indicating whether an experiment is current running.
Definition runner.cpp:106
double run(Simulation &baseline, const unsigned int trial_runs)
Run an experiment for baseline scenario only.
Definition runner.cpp:17
Runner()=delete
Defines the simulation engine data type class.
Definition simulation.h:24
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
@ baseline
Baseline scenario.
@ intervention
Intervention scenario.
Global namespace.
Definition column_iterator.h:123