Person Class Reference
|
CPP API
|
Agents in the simulated Model that can carry and spread the Infection. More...
#include <person.h>
Public Member Functions | |
| void | add_new_infection (Infection &&inf) |
| Adds a new Infection to the list of Infections. More... | |
| void | add_new_vaccination (ProtectionType v, TimePoint t) |
| Add a new vaccination. More... | |
| void | add_test_result (TimePoint t, TestType type, bool result) |
| Add TestResult to the Person. More... | |
| void | add_time_at_location (const TimeSpan dt) |
| Add to the time the Person has been at its current Location. More... | |
| auto | default_serialize () |
| This method is used by the default serialization feature. More... | |
| AgeGroup | get_age () const |
| Get the AgeGroup of this Person. More... | |
| LocationId | get_assigned_location (LocationType type) const |
| Returns the index of an assigned Location of the Person. More... | |
| int | get_assigned_location_model_id (LocationType type) const |
| Returns the model id of an assigned location of the Person. More... | |
| const std::vector< int > & | get_assigned_location_model_ids () const |
| Get the assigned locations' model ids of the Person. More... | |
| const std::vector< LocationId > & | get_assigned_locations () const |
| Get the assigned Locations of the Person. More... | |
| std::vector< uint32_t > & | get_cells () |
| Get index of Cells of the Person. More... | |
| const std::vector< uint32_t > & | get_cells () const |
| ScalarType | get_compliance (InterventionType intervention_type) const |
| Get the compliance of the Person for an Intervention. More... | |
| TimeSpan | get_go_to_school_time (const Parameters ¶ms) const |
| Draw at what time the Person goes to work. More... | |
| TimeSpan | get_go_to_work_time (const Parameters ¶ms) const |
| Draw at what time the Person goes to work. More... | |
| PersonId | get_id () const |
| Get the PersonId of the Person. More... | |
| Infection & | get_infection () |
| Get the latest #Infection of the Person. More... | |
| const Infection & | get_infection () const |
| InfectionState | get_infection_state (TimePoint t) const |
| Get the InfectionState of the Person at a specific TimePoint. More... | |
| mio::abm::TransportMode | get_last_transport_mode () const |
| Get the transport mode the Person used to get to its current Location. More... | |
| ProtectionEvent | get_latest_protection (TimePoint t) const |
| Get the latest ProtectionType and its initial TimePoint of the Person. More... | |
| LocationId | get_location () const |
| Get the current Location of the Person. More... | |
| int | get_location_model_id () const |
| LocationType | get_location_type () const |
| Mask & | get_mask () |
| Get the current Mask of the Person. More... | |
| const Mask & | get_mask () const |
| ScalarType | get_mask_protective_factor (const Parameters ¶ms) const |
| Get the protection of the Mask. More... | |
| ScalarType | get_protection_factor (TimePoint t, VirusVariant virus, const Parameters ¶ms) const |
| Get the multiplicative factor on how likely an #Infection is due to the immune system. More... | |
| Counter< uint32_t > & | get_rng_counter () |
| Get this persons RandomNumberGenerator counter. More... | |
| uint32_t | get_rng_index () |
| Get this Person's index that is used for the RandomNumberGenerator. More... | |
| mio::Key< uint64_t > | get_rng_key () |
| Get this Person's key that is used for the RandomNumberGenerator. More... | |
| TestResult | get_test_result (TestType type) const |
| Get the most recent TestResult performed from the Person based on the TestType. More... | |
| bool | get_tested (PersonalRandomNumberGenerator &rng, TimePoint t, const TestParameters ¶ms) |
| Simulates a viral test and returns the test result of the Person. More... | |
| TimeSpan | get_time_at_location () const |
| Get the time the Person has been at its current Location. More... | |
| bool | goes_to_school (TimePoint t, const Parameters ¶ms) const |
| Draw if the Person goes to school or stays at home during lockdown. More... | |
| bool | goes_to_work (TimePoint t, const Parameters ¶ms) const |
| Draw if the Person goes to work or is in home office during lockdown at a specific TimePoint. More... | |
| bool | is_compliant (PersonalRandomNumberGenerator &rng, InterventionType intervention) const |
| Checks whether the Person complies an Intervention. More... | |
| bool | is_in_quarantine (TimePoint t, const Parameters ¶ms) const |
| Answers the question if a Person is currently in quarantine. More... | |
| bool | is_infected (TimePoint t) const |
| Returns if the Person is infected at the TimePoint. More... | |
| bool | operator== (const Person &other) const |
| Compare two Persons. More... | |
| Person (const Person &other, PersonId person_id) | |
| Person (mio::RandomNumberGenerator &rng, LocationType location_type, LocationId location_id, int location_model_id, AgeGroup age, PersonId person_id=PersonId::invalid_ID()) | |
| Create a Person. More... | |
| void | remove_quarantine () |
| Removes the quarantine status of the Person. More... | |
| void | set_assigned_location (LocationType type, LocationId id, int model_id) |
| Set an assigned Location of the Person. More... | |
| void | set_compliance (InterventionType intervention_type, ScalarType value) |
| For every InterventionType a Person has a compliance value between 0 and 1. More... | |
| void | set_last_transport_mode (const mio::abm::TransportMode mode) |
| Set the transport mode the Person used to get to its current Location. More... | |
| void | set_location (LocationType type, LocationId id, int model_id) |
| Change the location of the person. More... | |
| void | set_mask (MaskType type, TimePoint t) |
| Change the mask to new type. More... | |
| std::vector< ProtectionEvent > & | get_vaccinations () |
| Get all vaccinations of the Person. More... | |
| const std::vector< ProtectionEvent > & | get_vaccinations () const |
| Get all vaccinations of the Person. More... | |
Private Attributes | |
| AgeGroup | m_age |
| AgeGroup the Person belongs to. More... | |
| std::vector< int > | m_assigned_location_model_ids |
| Vector with model ids of the assigned locations. Only used in graph abm. More... | |
| std::vector< LocationId > | m_assigned_locations |
| std::vector< uint32_t > | m_cells |
| Vector with all Cells the Person visits at its current Location. More... | |
| std::vector< ScalarType > | m_compliance |
| Vector of compliance values for all InterventionTypes. Values from 0 to 1. More... | |
| TimePoint | m_home_isolation_start |
| TimePoint when the Person started isolation at home. More... | |
| std::vector< Infection > | m_infections |
| Vector with all Infections the Person had. More... | |
| mio::abm::TransportMode | m_last_transport_mode |
| TransportMode the Person used to get to its current Location. More... | |
| LocationId | m_location |
| Current Location of the Person. More... | |
| int | m_location_model_id |
| Model id of the current Location. Only used for Graph ABM. More... | |
| LocationType | m_location_type |
| Type of the current Location. More... | |
| Mask | m_mask |
| The Mask of the Person. More... | |
| PersonId | m_person_id |
| Unique identifier of a person. More... | |
| ScalarType | m_random_goto_school_hour |
| Value to determine at what time the Person goes to school. More... | |
| ScalarType | m_random_goto_work_hour |
| Value to determine at what time the Person goes to work. More... | |
| ScalarType | m_random_schoolgroup |
| Value to determine if the Person goes to school or stays at home during lockdown. More... | |
| ScalarType | m_random_workgroup |
| Value to determine if the Person goes to work or works from home during lockdown. More... | |
| Counter< uint32_t > | m_rng_counter {0} |
| counter for RandomNumberGenerator. More... | |
| uint32_t | m_rng_index |
| Index for PersonalRandomNumberGenerator. More... | |
| mio::Key< uint64_t > | m_rng_key |
| Key for PersonalRandomNumberGenerator. More... | |
| CustomIndexArray< TestResult, TestType > | m_test_results |
| CustomIndexArray for TestResults. More... | |
| TimeSpan | m_time_at_location |
| Time the Person has spent at its current Location so far. More... | |
| std::vector< ProtectionEvent > | m_vaccinations |
| ! Vector with the indices of the assigned Locations so that the Person always visits the same Home or School etc. More... | |
Detailed Description
Constructor & Destructor Documentation
◆ Person() [1/2]
|
explicit |
◆ Person() [2/2]
Member Function Documentation
◆ add_new_infection()
| void mio::abm::Person::add_new_infection | ( | Infection && | inf | ) |
◆ add_new_vaccination()
|
inline |
Add a new vaccination.
- Parameters
-
[in] v ProtectionType (i. e. vaccine) the person takes. [in] t TimePoint of the vaccination.
◆ add_test_result()
Add TestResult to the Person.
- Parameters
-
[in] t The TimePoint of the test. [in] type The TestType of the test. [in] result The result of the test.
◆ add_time_at_location()
|
inline |
◆ default_serialize()
|
inline |
This method is used by the default serialization feature.
◆ get_age()
|
inline |
◆ get_assigned_location()
| LocationId mio::abm::Person::get_assigned_location | ( | LocationType | type | ) | const |
Returns the index of an assigned Location of the Person.
Assume that a Person has at most one assigned Location of a certain LocationType.
- Parameters
-
[in] type LocationType of the assigned Location.
- Returns
- The index in the LocationId of the assigned Location.
◆ get_assigned_location_model_id()
| int mio::abm::Person::get_assigned_location_model_id | ( | LocationType | type | ) | const |
Returns the model id of an assigned location of the Person.
Assume that a Person has at most one assigned Location of a certain LocationType.
- Parameters
-
[in] type LocationType of the assigned Location.
- Returns
- The model id of the assigned Location.
◆ get_assigned_location_model_ids()
|
inline |
◆ get_assigned_locations()
|
inline |
◆ get_cells() [1/2]
| std::vector< uint32_t > & mio::abm::Person::get_cells | ( | ) |
◆ get_cells() [2/2]
| const std::vector< uint32_t > & mio::abm::Person::get_cells | ( | ) | const |
◆ get_compliance()
|
inline |
Get the compliance of the Person for an Intervention.
- Parameters
-
[in] intervention_type The InterventionType.
- Returns
- The probability that the Person complies to an Intervention.
◆ get_go_to_school_time()
| TimeSpan mio::abm::Person::get_go_to_school_time | ( | const Parameters & | params | ) | const |
Draw at what time the Person goes to work.
Every Person has a random number to determine what time to go to school. Depending on this number Person decides what time has to go to school.
- Parameters
-
[in] params Parameters that describe the mobility between Locations.
- Returns
- The time of going to school.
◆ get_go_to_work_time()
| TimeSpan mio::abm::Person::get_go_to_work_time | ( | const Parameters & | params | ) | const |
Draw at what time the Person goes to work.
Every Person has a random number to determine what time to go to work. Depending on this number Person decides what time has to go to work.
- Parameters
-
[in] params Parameters that describe the mobility between Locations.
- Returns
- The time of going to work.
◆ get_id()
◆ get_infection() [1/2]
| Infection & mio::abm::Person::get_infection | ( | ) |
◆ get_infection() [2/2]
| const Infection & mio::abm::Person::get_infection | ( | ) | const |
◆ get_infection_state()
| InfectionState mio::abm::Person::get_infection_state | ( | TimePoint | t | ) | const |
Get the InfectionState of the Person at a specific TimePoint.
- Parameters
-
[in] t TimePoint of querry. Usually the current time of the Simulation.
- Returns
- The InfectionState of the latest Infection at time t.
◆ get_last_transport_mode()
|
inline |
◆ get_latest_protection()
| ProtectionEvent mio::abm::Person::get_latest_protection | ( | TimePoint | t | ) | const |
Get the latest ProtectionType and its initial TimePoint of the Person.
- Parameters
-
[in] t TimePoint to check.
◆ get_location()
| LocationId mio::abm::Person::get_location | ( | ) | const |
◆ get_location_model_id()
|
inline |
◆ get_location_type()
|
inline |
◆ get_mask() [1/2]
|
inline |
◆ get_mask() [2/2]
|
inline |
◆ get_mask_protective_factor()
| ScalarType mio::abm::Person::get_mask_protective_factor | ( | const Parameters & | params | ) | const |
◆ get_protection_factor()
| ScalarType mio::abm::Person::get_protection_factor | ( | TimePoint | t, |
| VirusVariant | virus, | ||
| const Parameters & | params | ||
| ) | const |
Get the multiplicative factor on how likely an #Infection is due to the immune system.
- Parameters
-
[in] t TimePoint of check. [in] virus VirusVariant to check [in] params Parameters in the model.
- Returns
- Protection factor for general #Infection of the immune system to the given VirusVariant at the given TimePoint.
◆ get_rng_counter()
|
inline |
Get this persons RandomNumberGenerator counter.
◆ get_rng_index()
|
inline |
Get this Person's index that is used for the RandomNumberGenerator.
◆ get_rng_key()
|
inline |
Get this Person's key that is used for the RandomNumberGenerator.
◆ get_test_result()
| TestResult mio::abm::Person::get_test_result | ( | TestType | type | ) | const |
Get the most recent TestResult performed from the Person based on the TestType.
If time_of_testing == TimePoint(std::numeric_limits<int>::min()), there is no previous TestResult.
- Parameters
-
[in] type The TestType of the test.
- Returns
- The latest TestResult of the given Type.
◆ get_tested()
| bool mio::abm::Person::get_tested | ( | PersonalRandomNumberGenerator & | rng, |
| TimePoint | t, | ||
| const TestParameters & | params | ||
| ) |
Simulates a viral test and returns the test result of the Person.
If the test is positive, the Person has to quarantine. If the test is negative, quarantine ends.
- Parameters
-
[in,out] rng RandomNumberGenerator of the Person. [in] t TimePoint of the test. [in] params Sensitivity and specificity of the test method.
- Returns
- True if the test result of the Person is positive.
◆ get_time_at_location()
|
inline |
◆ get_vaccinations() [1/2]
|
inline |
Get all vaccinations of the Person.
- Returns
- A vector with all vaccinations.
◆ get_vaccinations() [2/2]
|
inline |
Get all vaccinations of the Person.
- Returns
- A vector with all vaccinations.
◆ goes_to_school()
| bool mio::abm::Person::goes_to_school | ( | TimePoint | t, |
| const Parameters & | params | ||
| ) | const |
Draw if the Person goes to school or stays at home during lockdown.
Every Person has a random number that determines if they go to school in case of a lockdown.
- Parameters
-
[in] t The TimePoint of interest. Usually the current time of the Simulation. [in] params Parameters that describe the mobility between Locations.
- Returns
- True if the Person goes to school.
◆ goes_to_work()
| bool mio::abm::Person::goes_to_work | ( | TimePoint | t, |
| const Parameters & | params | ||
| ) | const |
Draw if the Person goes to work or is in home office during lockdown at a specific TimePoint.
Every Person has a random number. Depending on this number and the time, the Person works from home in case of a lockdown.
- Parameters
-
[in] t The TimePoint of interest. Usually the current time of the Simulation. [in] params Parameters that describe the mobility between Locations.
- Returns
- True the Person works from home.
◆ is_compliant()
| bool mio::abm::Person::is_compliant | ( | PersonalRandomNumberGenerator & | rng, |
| InterventionType | intervention | ||
| ) | const |
Checks whether the Person complies an Intervention.
- Parameters
-
[in,out] rng PersonalRandomNumberGenerator of the Person. [in] intervention The InterventionType.
- Returns
- Checks whether the Person complies an Intervention.
◆ is_in_quarantine()
|
inline |
Answers the question if a Person is currently in quarantine.
If a Person is in quarantine this Person cannot change to Locations other than Home or the Hospital.
- Parameters
-
[in] t The TimePoint of interest. Usually the current time of the Simulation. [in] params Parameter that includes the length of a quarantine.
- Returns
- True if the Person is in quarantine.
◆ is_infected()
| bool mio::abm::Person::is_infected | ( | TimePoint | t | ) | const |
◆ operator==()
◆ remove_quarantine()
| void mio::abm::Person::remove_quarantine | ( | ) |
Removes the quarantine status of the Person.
◆ set_assigned_location()
| void mio::abm::Person::set_assigned_location | ( | LocationType | type, |
| LocationId | id, | ||
| int | model_id = 0 |
||
| ) |
Set an assigned Location of the Person.
Important: Setting incorrect values will cause issues during simulation. It is preferable to use Model::assign_location with a valid LocationId, obtained e.g. through Model::add_location.
The assigned Location is saved by the index of its LocationId. Assume that a Person has at most one assigned Location of a certain LocationType.
- Parameters
-
[in] type The LocationType of the Location. [in] id The LocationId of the Location. [in] model_id The model id of the Location.
◆ set_compliance()
|
inline |
For every InterventionType a Person has a compliance value between 0 and 1.
0 means that the Person never complies to the Intervention. 1 means that the Person always complies to the Intervention.
- Parameters
-
[in] intervention_type The InterventionType. [in] value The compliance value.
◆ set_last_transport_mode()
|
inline |
◆ set_location()
| void mio::abm::Person::set_location | ( | LocationType | type, |
| LocationId | id, | ||
| int | model_id | ||
| ) |
Change the location of the person.
- Parameters
-
[in] type The LocationType of the new Location. [in] id The LocationId of the new Location. [in] model_id The model id of the new Location.
◆ set_mask()
Member Data Documentation
◆ m_age
◆ m_assigned_location_model_ids
|
private |
Vector with model ids of the assigned locations. Only used in graph abm.
◆ m_assigned_locations
|
private |
◆ m_cells
|
private |
◆ m_compliance
|
private |
Vector of compliance values for all InterventionTypes. Values from 0 to 1.
◆ m_home_isolation_start
|
private |
◆ m_infections
|
private |
◆ m_last_transport_mode
|
private |
◆ m_location
|
private |
◆ m_location_model_id
|
private |
◆ m_location_type
|
private |
Type of the current Location.
◆ m_mask
◆ m_person_id
|
private |
Unique identifier of a person.
◆ m_random_goto_school_hour
|
private |
Value to determine at what time the Person goes to school.
◆ m_random_goto_work_hour
|
private |
Value to determine at what time the Person goes to work.
◆ m_random_schoolgroup
|
private |
Value to determine if the Person goes to school or stays at home during lockdown.
◆ m_random_workgroup
|
private |
Value to determine if the Person goes to work or works from home during lockdown.
◆ m_rng_counter
|
private |
counter for RandomNumberGenerator.
◆ m_rng_index
|
private |
◆ m_rng_key
|
private |
Key for PersonalRandomNumberGenerator.
◆ m_test_results
|
private |
CustomIndexArray for TestResults.
◆ m_time_at_location
|
private |
◆ m_vaccinations
|
private |
Generated by