31 const std::string &
name() const noexcept
override {
return name_; }
34 std::string name_{
"Intervention"};
59 std::optional<unsigned int> end_age = std::nullopt)
60 : risk_factor{
std::move(risk_factor_key)}, value{policy_impact}, from_age{start_age},
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.");
75 unsigned int from_age{};
78 std::optional<unsigned int> to_age{};
84 bool contains(
unsigned int age)
const noexcept {
89 if (to_age.has_value()) {
90 return age <= to_age.value();
105 PolicyInterval(
int start_at_time, std::optional<int> finish_at_time = std::nullopt)
106 : start_time{start_at_time}, finish_time{finish_at_time} {
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.");
120 std::optional<int> finish_time{};
127 if (time < start_time) {
131 if (finish_time.has_value()) {
132 return time <= finish_time.value();
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:8
ScenarioType
Health GPS policy scenario types enumeration.
Definition scenario.h:17
@ intervention
Intervention scenario.
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
Defines the policy impact on risk factors data structure.
Definition intervention_scenario.h:49
bool contains(unsigned int age) const noexcept
Determine whether this impact should be applied to a given age.
Definition intervention_scenario.h:84
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
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
bool contains(int time) const noexcept
Determine whether this interval contains a given time.
Definition intervention_scenario.h:126
Entity unique identifier data type.
Definition identifier.h:20