Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::EducationLifecycleTables Class Reference

#include <jacardi_education_lifecycle.h>

Classes

struct  Stratum
 One empirical stratum: sorted education ids + matching probabilities (sum ≈ 1). More...

Public Member Functions

void set_lookup (std::unordered_map< std::uint64_t, Stratum > table)
void set_draw_at_19 (std::unordered_map< std::uint64_t, Stratum > table)
void set_upgrades (std::unordered_map< std::uint64_t, Stratum > table)
bool has_lookup () const noexcept
bool has_draw_at_19 () const noexcept
bool has_upgrades () const noexcept
double initialise (unsigned int age, core::Gender gender, Random &rng) const
 Part A — assign education once for a person at a given age.
double update (unsigned int age, core::Gender gender, int year, double current, Random &rng) const
 Part B — yearly step after ageing. current may be NaN (missing).

Static Public Member Functions

static int gender_code (core::Gender gender)
static std::uint64_t key_age_gender (int age, int gender) noexcept
static std::uint64_t key_year_gender (int year, int gender) noexcept
static std::uint64_t key_upgrade (int year, int age, int gender, int from_id) noexcept
static int draw (const Stratum &stratum, Random &rng)
 Inverse-CDF draw over a stratum (ids sorted ascending).

Static Public Attributes

static constexpr double missing = std::numeric_limits<double>::quiet_NaN()
static constexpr int max_lookup_age = 110
static constexpr int max_update_year = 2110
static constexpr unsigned int age_missing_max = 18U
static constexpr unsigned int age_draw = 19U
static constexpr unsigned int age_upgrade_max = 30U

Detailed Description

MAHIMA: Slovenia-style education lifecycle for JACARDI (partner algo 15 Oct 2026).

Two phases (same tables object, different call sites):

Values live on Person.risk_factors["Education"] as education_id 1..7. Ages 0–18 use NaN (= missing). CSV gender codes: 1 = male, 0 = female.

Threading: tables are immutable after load → safe for concurrent reads. Do NOT parallelise the person loops while they share one Random — RNG is not thread-safe. Per-person work is a map lookup + a few compares; analysis/disease paths dominate runtime, so leave these loops serial until we have thread-local RNG.

Age thresholds are named constants below so partners can retune rules without hunting magic numbers.

Member Function Documentation

◆ draw()

int hgps::EducationLifecycleTables::draw ( const Stratum & stratum,
Random & rng )
static

Inverse-CDF draw over a stratum (ids sorted ascending).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gender_code()

int hgps::EducationLifecycleTables::gender_code ( core::Gender gender)
static
Here is the caller graph for this function:

◆ has_draw_at_19()

bool hgps::EducationLifecycleTables::has_draw_at_19 ( ) const
inlinenoexcept

◆ has_lookup()

bool hgps::EducationLifecycleTables::has_lookup ( ) const
inlinenoexcept

◆ has_upgrades()

bool hgps::EducationLifecycleTables::has_upgrades ( ) const
inlinenoexcept

◆ initialise()

double hgps::EducationLifecycleTables::initialise ( unsigned int age,
core::Gender gender,
Random & rng ) const

Part A — assign education once for a person at a given age.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ key_age_gender()

std::uint64_t hgps::EducationLifecycleTables::key_age_gender ( int age,
int gender )
staticnoexcept
Here is the caller graph for this function:

◆ key_upgrade()

std::uint64_t hgps::EducationLifecycleTables::key_upgrade ( int year,
int age,
int gender,
int from_id )
staticnoexcept
Here is the caller graph for this function:

◆ key_year_gender()

std::uint64_t hgps::EducationLifecycleTables::key_year_gender ( int year,
int gender )
staticnoexcept
Here is the caller graph for this function:

◆ set_draw_at_19()

void hgps::EducationLifecycleTables::set_draw_at_19 ( std::unordered_map< std::uint64_t, Stratum > table)

◆ set_lookup()

void hgps::EducationLifecycleTables::set_lookup ( std::unordered_map< std::uint64_t, Stratum > table)

◆ set_upgrades()

void hgps::EducationLifecycleTables::set_upgrades ( std::unordered_map< std::uint64_t, Stratum > table)

◆ update()

double hgps::EducationLifecycleTables::update ( unsigned int age,
core::Gender gender,
int year,
double current,
Random & rng ) const

Part B — yearly step after ageing. current may be NaN (missing).

Here is the call graph for this function:

Member Data Documentation

◆ age_draw

unsigned int hgps::EducationLifecycleTables::age_draw = 19U
staticconstexpr

◆ age_missing_max

unsigned int hgps::EducationLifecycleTables::age_missing_max = 18U
staticconstexpr

◆ age_upgrade_max

unsigned int hgps::EducationLifecycleTables::age_upgrade_max = 30U
staticconstexpr

◆ max_lookup_age

int hgps::EducationLifecycleTables::max_lookup_age = 110
staticconstexpr

◆ max_update_year

int hgps::EducationLifecycleTables::max_update_year = 2110
staticconstexpr

◆ missing

double hgps::EducationLifecycleTables::missing = std::numeric_limits<double>::quiet_NaN()
staticconstexpr

The documentation for this class was generated from the following files: