Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
healthgps.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 #include "event_aggregator.h"
6 #include "runtime_context.h"
7 #include "simulation.h"
8 #include "simulation_module.h"
9 
10 namespace hgps {
11 
21 class HealthGPS : public Simulation {
22  public:
23  HealthGPS() = delete;
24 
29  explicit HealthGPS(SimulationDefinition &&definition, SimulationModuleFactory &factory,
30  EventAggregator &bus);
31 
32  void initialize() override;
33  void terminate() override;
34 
38  adevs::Time init(adevs::SimEnv<int> *env) override;
39 
43  adevs::Time update(adevs::SimEnv<int> *env) override;
44 
55  adevs::Time update(adevs::SimEnv<int> *env, std::vector<int> &x) override;
56 
59  void fini(adevs::Time clock) override;
60 
61  void setup_run(unsigned int run_number) noexcept override;
62 
63  void setup_run(unsigned int run_number, unsigned int seed) noexcept override;
64 
65  private:
66  RuntimeContext context_;
67  std::shared_ptr<UpdatableModule> ses_;
68  std::shared_ptr<DemographicModule> demographic_;
69  std::shared_ptr<RiskFactorHostModule> risk_factor_;
70  std::shared_ptr<DiseaseHostModule> disease_;
71  std::shared_ptr<UpdatableModule> analysis_;
72  adevs::Time end_time_;
73 
74  void initialise_population();
75  void update_population();
76  void print_initial_population_statistics();
77 
78  void update_net_immigration();
79 
80  hgps::IntegerAgeGenderTable get_current_expected_population() const;
81  hgps::IntegerAgeGenderTable get_current_simulated_population();
82  void apply_net_migration(int net_value, const unsigned int &age, const core::Gender &gender);
83  hgps::IntegerAgeGenderTable get_net_migration();
84  hgps::IntegerAgeGenderTable create_net_migration();
85  std::map<std::string, core::UnivariateSummary> create_input_data_summary() const;
86 
87  Person partial_clone_entity(const Person &source) const noexcept;
88 };
89 } // namespace hgps
Defines the age and gender lookup table data type.
Definition: gender_table.h:120
Defines the event aggregator interface type.
Definition: event_aggregator.h:59
Defines the simulation engine data type class.
Definition: healthgps.h:21
adevs::Time init(adevs::SimEnv< int > *env) override
Called when the model is added to the simulation executive.
Definition: healthgps.cpp:56
void fini(adevs::Time clock) override
Called after the model has been removed from the simulation executive.
Definition: healthgps.cpp:111
void initialize() override
Initialises the simulation experiment.
Definition: healthgps.cpp:33
void setup_run(unsigned int run_number) noexcept override
Set-up a new simulation run with default seed.
Definition: healthgps.cpp:47
HealthGPS()=delete
adevs::Time update(adevs::SimEnv< int > *env) override
Called to assign a new state to the model at current time.
Definition: healthgps.cpp:77
void terminate() override
Terminates the simulation experiment.
Definition: healthgps.cpp:43
Defines the Simulation runtime context data type.
Definition: runtime_context.h:21
Defines the SimulationModule factory data type.
Definition: modulefactory.h:21
Defines the simulation class interface.
Definition: simulation.h:9
Gender
Enumerates gender types.
Definition: forward_type.h:18
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
Defines a virtual population person data type.
Definition: person.h:40
Simulation experiment definition data type.
Definition: simulation_definition.h:13