Simulation< FP, Comp, Status, Region > Class Template Reference
|
CPP API
|
A specialized Simulation for mio::smm::Model. More...
#include <simulation.h>
Public Types | |
| using | Model = smm::Model< FP, Comp, Status, Region > |
Public Member Functions | |
| Eigen::Ref< Eigen::VectorX< FP > > | advance (FP tmax) |
| Advance simulation to tmax. More... | |
| Model & | get_model () |
| const Model & | get_model () const |
| Returns the model used in the simulation. More... | |
| TimeSeries< FP > & | get_result () |
| Returns the final simulation result. More... | |
| const TimeSeries< FP > & | get_result () const |
| Simulation (Model const &model, FP t0=0., FP dt=1.) | |
| Set up the simulation for a Stochastic Metapopulation Model. More... | |
Private Member Functions | |
| constexpr const smm::AdoptionRates< FP, Status, Region >::Type & | adoption_rates () |
| Returns the model's adoption rates. More... | |
| size_t | determine_next_event () |
| Get next event i.e. More... | |
| constexpr const smm::TransitionRates< FP, Status, Region >::Type & | transition_rates () |
| Returns the model's transition rates. More... | |
| void | update_current_rates_and_waiting_times () |
| Calculate current values for m_current_rates and m_waiting_times. More... | |
Private Attributes | |
| std::vector< FP > | m_current_rates |
| Current values of both types of rates i.e. adoption and transition rates. More... | |
| FP | m_dt |
| Initial step size. More... | |
| std::vector< FP > | m_internal_time |
| Internal times of all poisson processes (aka T_k). More... | |
| std::unique_ptr< Model > | m_model |
| Pointer to the model used in the simulation. More... | |
| mio::TimeSeries< FP > | m_result |
| Result time series. More... | |
| std::vector< FP > | m_tp_next_event |
| Internal time points of next event i after m_internal[i] (aka P_k). More... | |
| std::vector< FP > | m_waiting_times |
| External times between m_internal_time and m_tp_next_event. More... | |
Detailed Description
template<typename FP, class Comp, class Status = Comp, class Region = mio::regions::Region>
class mio::smm::Simulation< FP, Comp, Status, Region >
A specialized Simulation for mio::smm::Model.
- Template Parameters
-
regions The number of regions. Status An infection state enum.
Member Typedef Documentation
◆ Model
| using mio::smm::Simulation< FP, Comp, Status, Region >::Model = smm::Model<FP, Comp, Status, Region> |
Constructor & Destructor Documentation
◆ Simulation()
|
inline |
Set up the simulation for a Stochastic Metapopulation Model.
- Parameters
-
[in] model An instance of mio::smm::Model. [in] t0 Start time. [in] dt Initial Step size.
Member Function Documentation
◆ adoption_rates()
|
inlineconstexprprivate |
Returns the model's adoption rates.
◆ advance()
|
inline |
Advance simulation to tmax.
This function performs a Gillespie algorithm.
- Parameters
-
tmax Next stopping point of simulation.
◆ determine_next_event()
|
inlineprivate |
Get next event i.e.
event with the smallest waiting time.
◆ get_model() [1/2]
|
inline |
◆ get_model() [2/2]
|
inline |
Returns the model used in the simulation.
◆ get_result() [1/2]
|
inline |
Returns the final simulation result.
- Returns
- A TimeSeries to represent the final simulation result.
◆ get_result() [2/2]
|
inline |
◆ transition_rates()
|
inlineconstexprprivate |
Returns the model's transition rates.
◆ update_current_rates_and_waiting_times()
|
inlineprivate |
Calculate current values for m_current_rates and m_waiting_times.
Member Data Documentation
◆ m_current_rates
|
private |
Current values of both types of rates i.e. adoption and transition rates.
◆ m_dt
|
private |
Initial step size.
◆ m_internal_time
|
private |
Internal times of all poisson processes (aka T_k).
◆ m_model
|
private |
Pointer to the model used in the simulation.
◆ m_result
|
private |
Result time series.
◆ m_tp_next_event
|
private |
Internal time points of next event i after m_internal[i] (aka P_k).
◆ m_waiting_times
|
private |
External times between m_internal_time and m_tp_next_event.
Generated by