Population class.
More...
#include <population.hpp>
|
| Population (const size_t initial_size, std::random_device::result_type seed, const double carrying_capacity=1e3, const double recruitment_coef=2.0, const double negative_binom_k=-1.0) |
| Constructor.
|
|
void | run (const int_fast32_t simulating_duration, const std::vector< size_t > &sample_size_adult={1u, 1u}, const std::vector< size_t > &sample_size_juvenile={1u, 1u}, const int_fast32_t recording_duration=1) |
| Main iteration.
|
|
std::ostream & | write_sample_family (std::ostream &ost) const |
|
std::ostream & | write_demography (std::ostream &) const |
| Write demography_.
|
|
std::ostream & | write (std::ostream &) const |
| Write subpopulations_ and juveniles_subpops_ for debugging.
|
|
|
void | reproduce () |
| give birth to children
|
|
void | reproduce (uint_fast32_t location, size_t popsize) |
|
void | survive (int_fast32_t season) |
| Evaluate survival.
|
|
void | migrate () |
| Evaluate migration. Individuals in juveniles_subpops_ moves to subpopulations_.
|
|
void | sample (std::vector< std::vector< std::shared_ptr< Individual > > > *subpops, const std::vector< size_t > &sample_sizes) |
| Sample individuals.
|
|
void | append_demography (int_fast32_t season) |
| Append current state to demography_.
|
|
std::vector< std::vector< uint_fast32_t > > | count (int_fast32_t season) const |
| Count individuals for each location and age.
|
|
size_t | num_subpops () const noexcept |
| Return size of subpopulations_.
|
|
|
std::vector< std::vector< std::shared_ptr< Individual > > > | subpopulations_ |
| Individual array for each subpopulation.
|
|
std::vector< std::vector< std::shared_ptr< Individual > > > | juveniles_subpops_ |
|
std::vector< std::vector< uint_fast32_t > > | juveniles_demography_ = {} |
| Counts of juveniles of the year: [[number for each location] for each season].
|
|
std::vector< std::map< int_fast32_t, std::vector< std::shared_ptr< Individual > > > > | loc_year_samples_ = {} |
| Samples: [{capture_year => individuals} for each location].
|
|
std::map< std::pair< int_fast32_t, int_fast32_t >, std::vector< std::vector< uint_fast32_t > > > | demography_ = {} |
| (year, season) => [[count for each age] for each location]
|
|
int_fast32_t | year_ = 0 |
|
std::unique_ptr< URBG > | engine_ |
| Uniform Random Bit Generator.
|
|
|
const double | carrying_capacity_ |
| \(K\): carrying capacity used in reproduce()
|
|
const double | recruitment_coef_ |
| \(r\): coefficient used in reproduce()
|
|
const double | k_nbinom_ |
|
|
std::ostream & | operator<< (std::ostream &ost, const Population &pop) |
| Shortcut for Population::write(ost)
|
|
◆ reproduce()
void pbf::Population::reproduce |
( |
uint_fast32_t | location, |
|
|
size_t | popsize ) |
|
private |
Append new individuals to juveniles_subpops_ at location
. The expected number of children for each adult is proportional to its weight. All the females are evaluated for recruitment, whereas males are stochastically chosen.
◆ write_sample_family()
std::ostream & pbf::Population::write_sample_family |
( |
std::ostream & | ost | ) |
const |
Construct and write tree from loc_year_samples_. Serial IDs are assigned to sampled individuals. IDs larger than sample size are assigned to unsampled ancestors.
◆ juveniles_subpops_
std::vector<std::vector<std::shared_ptr<Individual> > > pbf::Population::juveniles_subpops_ |
|
private |
First-year individuals separated for sample(). Note that it becomes empty in migrate().
◆ year_
int_fast32_t pbf::Population::year_ = 0 |
|
private |
The documentation for this class was generated from the following files: