QuadWell< InfectionState > Class Template Reference
|
CPP API
|
Implementation of diffusive ABM, see dabm::Model. More...
#include <quad_well.h>
Classes | |
| struct | Agent |
| Struct defining an agent for the diffusive ABM. More... | |
Public Types | |
| using | Status = InfectionState |
Public Member Functions | |
| ScalarType | adoption_rate (const Agent &agent, const Status &new_status) const |
| Calculate adoption rate for an Agent. More... | |
| std::map< std::tuple< mio::regions::Region, Status, Status >, mio::AdoptionRate< ScalarType, Status > > & | get_adoption_rates () |
| Get AdoptionRate mapping. More... | |
| mio::RandomNumberGenerator & | get_rng () |
| Get the RandomNumberGenerator used by this Model for random events. More... | |
| void | move (const ScalarType, const ScalarType dt, Agent &agent) |
| Perform one integration step of the diffusion process for a given Agent using the Euler-Maruyama method. More... | |
| std::vector< Eigen::MatrixX< ScalarType > > & | number_transitions () |
| const std::vector< Eigen::MatrixX< ScalarType > > & | number_transitions () const |
| Get the number of spatial transitions that happened until the current system state. More... | |
| QuadWell (const std::vector< Agent > &agents, const std::vector< mio::AdoptionRate< ScalarType, Status >> &rates, ScalarType contact_radius=0.4, ScalarType sigma=0.4, std::vector< Status > non_moving_states={}) | |
| Set up a diffusive ABM using the quadwell potential F(x,y) = (x^2 -1)^2+(y^2-1)^2. More... | |
| void | set_non_moving_regions (std::vector< size_t > non_moving_regions) |
| Set regions where no movement happens. More... | |
| Eigen::VectorX< ScalarType > | time_point () const |
| Calculate the current system state i.e. More... | |
Static Public Member Functions | |
| static constexpr void | adopt (Agent &agent, const Status &new_status) |
| Perform infection state adoption for an Agent. More... | |
Public Attributes | |
| std::vector< Agent > | populations |
| Vector containing all Agents in the model. More... | |
Private Member Functions | |
| bool | is_contact (const Agent &agent, const Agent &contact) const |
| Evaluate whether two agents are within their contact radius. More... | |
| bool | is_in_domain (const Position &p) const |
| Restrict domain to [-2, 2]^2 where "escaping" is impossible. More... | |
Static Private Member Functions | |
| static Position | grad_U (const Position x) |
| Claculate the gradient of the potential at a given position. More... | |
Private Attributes | |
| std::map< std::tuple< mio::regions::Region, Status, Status >, mio::AdoptionRate< ScalarType, Status > > | m_adoption_rates |
| Map of AdoptionRates according to their region index and their from -> to infection states. More... | |
| ScalarType | m_contact_radius |
| Agents' interaction radius. Within this radius agents are considered as contacts. More... | |
| std::vector< size_t > | m_non_moving_regions {} |
| Regions without movement. More... | |
| std::vector< Status > | m_non_moving_states |
| Infection states within which agents do not change their location. More... | |
| std::vector< Eigen::MatrixX< ScalarType > > | m_number_transitions |
| Vector that contains for every infection state a matrix with entry (k,l) the number of spatial transitions from Region k to Regionl. More... | |
| mio::RandomNumberGenerator | m_rng |
| Model's random number generator. More... | |
| ScalarType | m_sigma |
| Noise term of the diffusion process. More... | |
Detailed Description
template<class InfectionState>
class QuadWell< InfectionState >
Implementation of diffusive ABM, see dabm::Model.
This implementation defines a diffusion process for the potential F(x,y) = (x^2 -1)^2+(y^2-1)^2.
- Template Parameters
-
InfectionState An infection state enum.
Member Typedef Documentation
◆ Status
Constructor & Destructor Documentation
◆ QuadWell()
|
inline |
Set up a diffusive ABM using the quadwell potential F(x,y) = (x^2 -1)^2+(y^2-1)^2.
- Parameters
-
[in] agents A vector of Agents representing the population. [in] rates AdoptionRates defining InfectionState adoptions, see mio::AdoptionRate. [in] contact_radius Contact radius for second-order adoptions. [in] sigma Noise term for the diffusion process. [in] non_moving_state InfectionStates that are excluded from movement e.g. Dead.
Member Function Documentation
◆ adopt()
◆ adoption_rate()
|
inline |
Calculate adoption rate for an Agent.
- Parameters
-
[in] agent Agent for whom the adoption rate is calculated. [in] new_status Target infection state of the adoption rate, see mio::AdoptionRate.to.
- Returns
- Value of agent-dependent AdoptionRate.
◆ get_adoption_rates()
|
inline |
Get AdoptionRate mapping.
- Returns
- Map of AdoptionRates based on their region index and source and target infection state.
◆ get_rng()
|
inline |
Get the RandomNumberGenerator used by this Model for random events.
- Returns
- The random number generator.
◆ grad_U()
|
inlinestaticprivate |
Claculate the gradient of the potential at a given position.
- Parameters
-
[in] x Position at which the gradient is evaluated.
- Returns
- Value of potential gradient.
◆ is_contact()
|
inlineprivate |
Evaluate whether two agents are within their contact radius.
- Parameters
-
[in] agent Agent whose position specifies the contact area. [in] contact Potential contact of agent.
- Returns
- Boolean specifying whether are within each others contact radius.
◆ is_in_domain()
|
inlineprivate |
Restrict domain to [-2, 2]^2 where "escaping" is impossible.
- Parameters
-
[in] p Position to check.
- Returns
- Boolean specifying whether p is in [-2, 2]^2.
◆ move()
|
inline |
◆ number_transitions() [1/2]
|
inline |
◆ number_transitions() [2/2]
|
inline |
Get the number of spatial transitions that happened until the current system state.
- Returns
- Matrix with entries (from_well, to_well) for every infection state.
◆ set_non_moving_regions()
|
inline |
Set regions where no movement happens.
◆ time_point()
|
inline |
Calculate the current system state i.e.
the populations for each region and infection state.
- Returns
- Vector containing the number of agents per infection state for each region.
Member Data Documentation
◆ m_adoption_rates
|
private |
Map of AdoptionRates according to their region index and their from -> to infection states.
◆ m_contact_radius
|
private |
Agents' interaction radius. Within this radius agents are considered as contacts.
◆ m_non_moving_regions
|
private |
Regions without movement.
◆ m_non_moving_states
|
private |
Infection states within which agents do not change their location.
◆ m_number_transitions
|
private |
Vector that contains for every infection state a matrix with entry (k,l) the number of spatial transitions from Region k to Regionl.
◆ m_rng
|
private |
Model's random number generator.
◆ m_sigma
|
private |
Noise term of the diffusion process.
◆ populations
Generated by