31 const std::string &
name() const noexcept
override {
return name_; }
34 std::string name_{
"Intervention"};
59 std::optional<unsigned int> end_age = std::nullopt)
63 if (end_age.has_value() && start_age > end_age.value()) {
64 throw std::out_of_range(
"Impact end age must be equal or greater than the start age.");
78 std::optional<unsigned int>
to_age{};
84 bool contains(
unsigned int age)
const noexcept {
90 return age <=
to_age.value();
105 PolicyInterval(
int start_at_time, std::optional<int> finish_at_time = std::nullopt)
107 if (start_at_time < 0) {
108 throw std::out_of_range(
"Policy start time must not be negative.");
111 if (finish_at_time.has_value() && start_at_time > finish_at_time.value()) {
112 throw std::out_of_range(
113 "Policy finish time must be equal or greater than the start time.");
147 if (parameters.size() !=
size_t{3}) {
148 throw std::invalid_argument(
149 "The vector of dynamic arguments must have size = 3 [alpha, beta, gamma]");
152 for (
const auto &p : parameters) {
153 if (0.0 > p || p > 1.0) {
154 throw std::out_of_range(
"Dynamic argument: " + std::to_string(p) +
155 ", outside range [0.0, 1.0]");
159 alpha = parameters.at(0);
160 beta = parameters.at(1);
161 gamma = parameters.at(2);
Health-GPS dynamic intervention policy scenario interface.
Definition intervention_scenario.h:41
virtual const PolicyDynamic & dynamic() const noexcept=0
Gets the System Dynamic model parameters.
Health-GPS scripted intervention policy scenario interface.
Definition intervention_scenario.h:19
virtual const std::vector< PolicyImpact > & impacts() const noexcept=0
Gets the intervention impacts by risk factor and age range.
const std::string & name() const noexcept override
Gets the scenario type name.
Definition intervention_scenario.h:31
ScenarioType type() const noexcept override
Gets the scenario type identifier.
Definition intervention_scenario.h:29
virtual const PolicyInterval & active_period() const noexcept=0
Gets the intervention active period.
Health-GPS simulation scenario interface.
Definition scenario.h:30
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:9
ScenarioType
Health GPS policy scenario types enumeration.
Definition scenario.h:17
@ intervention
Intervention scenario.
Definition scenario.h:22
Global namespace.
Definition column_iterator.h:123
Defines the policy dynamic parameters.
Definition intervention_scenario.h:141
PolicyDynamic(const std::vector< double > ¶meters)
Initialises a new instance of the PolicyDynamic structure.
Definition intervention_scenario.h:146
double gamma
Gamma parameter, default 0.0 (no effect).
Definition intervention_scenario.h:171
double beta
Beta parameter, default 0.0 (no effect).
Definition intervention_scenario.h:168
double alpha
Alpha parameter, default 1.0 (full effect at start).
Definition intervention_scenario.h:165
Defines the policy impact on risk factors data structure.
Definition intervention_scenario.h:49
std::optional< unsigned int > to_age
Impact applies to age, if no value, no upper limit.
Definition intervention_scenario.h:78
double value
The effect value.
Definition intervention_scenario.h:72
bool contains(unsigned int age) const noexcept
Determine whether this impact should be applied to a given age.
Definition intervention_scenario.h:84
unsigned int from_age
Impact applies from age.
Definition intervention_scenario.h:75
PolicyImpact(core::Identifier risk_factor_key, double policy_impact, unsigned int start_age, std::optional< unsigned int > end_age=std::nullopt)
Initialise a new instance of the PolicyImpact structure.
Definition intervention_scenario.h:58
core::Identifier risk_factor
The risk factor identifier.
Definition intervention_scenario.h:69
Defines the policy active interval.
Definition intervention_scenario.h:99
PolicyInterval(int start_at_time, std::optional< int > finish_at_time=std::nullopt)
Initialise a new instance of the PolicyInterval structure.
Definition intervention_scenario.h:105
std::optional< int > finish_time
The intervention finish time, if given, or no upper bound.
Definition intervention_scenario.h:120
bool contains(int time) const noexcept
Determine whether this interval contains a given time.
Definition intervention_scenario.h:126
int start_time
The intervention start time.
Definition intervention_scenario.h:118
Entity unique identifier data type.
Definition identifier.h:20