graph_abmodel.h Source File
|
CPP API
|
graph_abmodel.h
Go to the documentation of this file.
162 if (person.is_in_quarantine(t, parameters) || person.get_infection_state(t) == InfectionState::Dead) {
168 if (target_location.is_mask_required() && !person.is_compliant(personal_rng, InterventionType::Mask)) {
191 person.set_location(abm::LocationType::Invalid, trip.destination, std::numeric_limits<int>::max());
const ParameterTagTraits< Tag >::Type & get() const
get value of a parameter
Definition: parameter_set.h:262
Definition: graph_abmodel.h:40
void evolve(TimePoint t, TimeSpan dt)
Evolve the Graph Model one time step.
Definition: graph_abmodel.h:78
GraphABModel(size_t num_agegroups, int id, std::vector< Base::MobilityRuleType > mobility_rules=std::vector< Base::MobilityRuleType >{&get_buried, &return_home_when_recovered, &go_to_hospital, &go_to_icu, &go_to_school, &go_to_work, &go_to_shop, &go_to_event, &go_to_quarantine})
Definition: graph_abmodel.h:44
std::vector< size_t > & get_person_buffer()
Get person buffer.
Definition: graph_abmodel.h:57
std::vector< size_t > m_person_buffer
List with indices of persons that are subject to move to another node.
Definition: graph_abmodel.h:202
void remove_person(size_t pos)
Removes person from the model.
Definition: graph_abmodel.h:66
void perform_mobility(TimePoint t, TimeSpan dt)
Definition: graph_abmodel.h:88
All Locations in the simulated Model where Persons gather.
Definition: location.h:92
LocationId get_id() const
Get the location's identifier in a Model.
Definition: location.h:143
bool is_mask_required() const
Get the information whether masks are required to enter this Location.
Definition: location.h:219
CellCapacity get_capacity(uint32_t cell_idx=0) const
Get the capacity of a specific Cell in persons and volume.
Definition: location.h:209
MaskType get_required_mask() const
Get the type of Mask that is demanded when entering this Location.
Definition: location.h:177
MaskType get_type() const
Get the MaskType of this Mask.
Definition: mask.h:49
TestingStrategy m_testing_strategy
List of TestingSchemes that are checked for testing.
Definition: abm/model.h:695
void interaction(TimePoint t, TimeSpan dt)
Persons interact at their Location and may become infected.
Definition: abm/model.cpp:91
TripList m_trip_list
List of all Trips the Persons do.
Definition: abm/model.h:696
void begin_step(TimePoint t, TimeSpan dt)
Prepare the Model for the next Simulation step.
Definition: abm/model.cpp:337
bool m_person_ids_equal_index
Current number of Persons in a given location.
Definition: abm/model.h:701
uint32_t get_person_index(PersonId person_id) const
Get index of person in m_persons.
Definition: abm/model.h:523
bool m_is_local_population_cache_valid
Current number of Persons in a given location.
Definition: abm/model.h:682
bool m_are_exposure_caches_valid
Current number of Persons in a given location.
Definition: abm/model.h:683
const Person & get_person(PersonId person_id) const
Get a reference to a Person from this Model.
Definition: abm/model.h:385
LocationId find_location(LocationType type, const PersonId person) const
Find an assigned Location of a Person.
Definition: abm/model.cpp:376
Model(size_t num_agegroups, int id=0)
Create a Model.
Definition: abm/model.h:70
int m_id
Model id. Is only used for abm graph model or hybrid model.
Definition: abm/model.h:686
std::vector< MobilityRuleType > m_mobility_rules
Rules that govern the mobility between Locations.
Definition: abm/model.h:698
std::vector< char > m_activeness_statuses
Vector with activeness status for every person.
Definition: abm/model.h:689
const Location & get_location(LocationId id) const
Get a reference to a location in this Model.
Definition: abm/model.h:472
RandomNumberGenerator & get_rng()
Get the RandomNumberGenerator used by this Model for random events.
Definition: abm/model.h:339
Parameters parameters
The simulation parameters of the Model.
Definition: abm/model.h:331
void change_location(PersonId person, LocationId destination, TransportMode mode=TransportMode::Unknown, const std::vector< uint32_t > &cells={0})
Let a Person change to another Location.
Definition: abm/model.h:449
std::vector< Person > m_persons
Vector of every Person.
Definition: abm/model.h:687
size_t get_number_persons(LocationId location) const
Get the total number of Persons at the Location.
Definition: abm/model.h:415
Agents in the simulated Model that can carry and spread the Infection.
Definition: person.h:50
void set_location(LocationType type, LocationId id, int model_id)
Change the location of the person.
Definition: person.cpp:98
Mask & get_mask()
Get the current Mask of the Person.
Definition: person.h:298
int get_assigned_location_model_id(LocationType type) const
Returns the model id of an assigned location of the Person.
Definition: person.cpp:127
bool is_compliant(PersonalRandomNumberGenerator &rng, InterventionType intervention) const
Checks whether the Person complies an Intervention.
Definition: person.cpp:219
LocationId get_location() const
Get the current Location of the Person.
Definition: person.cpp:93
void set_mask(MaskType type, TimePoint t)
Change the mask to new type.
Definition: person.cpp:264
Random number generator of individual persons.
Definition: personal_rng.h:49
bool run_and_check(PersonalRandomNumberGenerator &rng, Person &person, const Location &location, TimePoint t)
Runs the TestingStrategy and potentially tests a Person when entering.
Definition: testing_strategy.cpp:134
uint32_t get_current_index() const
Get the current index.
Definition: trip_list.h:153
const Trip & get_next_trip() const
Get the next Trip.
Definition: trip_list.cpp:29
void reset_index()
Reset the current index to 0.
Definition: trip_list.h:136
size_t num_trips() const
Get the length of the TripList.
Definition: trip_list.h:145
void increase_index()
Increment the current index to select the next Trip.
Definition: trip_list.h:128
static double floor(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &x)
Definition: ad.hpp:2451
static min_max_return_type< ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 >, ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > >::type max(const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &a, const ad::internal::active_type< AD_TAPE_REAL, DATA_HANDLER_1 > &b)
Definition: ad.hpp:2596
LocationType return_home_when_recovered(PersonalRandomNumberGenerator &, const Person &person, const TimePoint t, TimeSpan, const Parameters &)
Persons in the hospital/icu return home when they recover.
Definition: mobility_rules.cpp:159
LocationType go_to_event(PersonalRandomNumberGenerator &rng, const Person &person, TimePoint t, TimeSpan dt, const Parameters ¶ms)
Persons might go to social events.
Definition: mobility_rules.cpp:104
@ Invalid
LocationType go_to_school(PersonalRandomNumberGenerator &, const Person &person, TimePoint t, TimeSpan dt, const Parameters ¶ms)
School age children go to school in the morning and return later in the day.
Definition: mobility_rules.cpp:47
LocationType go_to_icu(PersonalRandomNumberGenerator &, const Person &person, const TimePoint t, TimeSpan, const Parameters &)
Persons in the hospital may be put in intensive care.
Definition: mobility_rules.cpp:149
TimeSpan seconds(int seconds)
Create a TimeSpan of a specified number of seconds.
Definition: time.h:321
LocationType go_to_work(PersonalRandomNumberGenerator &, const Person &person, TimePoint t, TimeSpan dt, const Parameters ¶ms)
Adults go to work in the morning and return later in the day.
Definition: mobility_rules.cpp:66
LocationType get_buried(PersonalRandomNumberGenerator &, const Person &person, const TimePoint t, TimeSpan, const Parameters &)
Persons in the icu go to cemetery when they are dead.
Definition: mobility_rules.cpp:170
TimeSpan days(int days)
Create a TimeSpan with a specified number of days.
Definition: time.h:348
LocationType go_to_shop(PersonalRandomNumberGenerator &rng, const Person &person, TimePoint t, TimeSpan dt, const Parameters ¶ms)
Adults may go shopping in their free time.
Definition: mobility_rules.cpp:85
LocationType go_to_hospital(PersonalRandomNumberGenerator &, const Person &person, const TimePoint t, TimeSpan, const Parameters &)
Infected Persons may be hospitalized.
Definition: mobility_rules.cpp:139
LocationType go_to_quarantine(PersonalRandomNumberGenerator &, const Person &person, TimePoint t, TimeSpan, const Parameters ¶ms)
Persons who are in quarantine should go home.
Definition: mobility_rules.cpp:128
@ None
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
requires details::IsElementReference< M > RowMajorIterator< M, false > begin(M &m)
create a non-const iterator to first element of the matrix m.
Definition: eigen_util.h:421
void log_info(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:108
uint32_t persons
Maximal number of Persons at the Cell.
Definition: location.h:59
static const LocationId invalid_id()
Value for invalid IDs.
Definition: location_id.h:48
Effectiveness of a Mask of a certain MaskType% against an Infection%.
Definition: abm/parameters.h:382
Generated by