Evolutionary Diversification in Anolis Lizards
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
edal::Individual Class Reference

sexual, diploid, additive, unlinked, diallelic More...

#include <individual.hpp>

Public Types

using param_type = IndividualParams
 Alias.
 
using URBG = wtl::sfmt19937_64
 Uniform Random Number Generator.
 
using Loci = std::bitset< NUM_LOCI_ >
 Alias for diallelic loci of a trait.
 

Public Member Functions

 Individual ()
 Default constructor for original individuals.
 
 Individual (const std::vector< Loci > &egg, const std::vector< Loci > &sperm, const bool is_male=false)
 Constructor for sexual reproduction.
 
 Individual (const std::vector< unsigned long > &)
 Homozygous initialization by bit values.
 
double effective_carrying_capacity_quad_unnormalized () const
 \(K_e(I)\) with quadratic \(\Xi\) before normalization (v3u) More...
 
double effective_carrying_capacity_exp_unnormalized () const
 \(K_e(I)\) with exponential \(\Xi\)
 
double effective_carrying_capacity_old_exp_unnormalized () const
 \(K_e(I)\) with old resource distribution and exponential \(\Xi\) before normalization
 
double effective_carrying_capacity_cache () const
 Find \(K_e(I)\) in KE_CACHE_ or calculate.
 
double preference_overlap (const Individual &other) const
 Exponent of \(C_y(I, J)\): competition on habitat preference. More...
 
double morphology_overlap (const Individual &other) const
 Exponent of \(C_x(I, J)\): competition on morphology. More...
 
double resource_overlap (const Individual &other) const
 \(C(I, J) = C_x(I,J) C_y(I,J)\) for competition
 
double survival_probability (const double effective_num_competitors) const
 Probability of survival \(w(I)\). More...
 
double mating_probability (const Individual &male) const
 \(P(I,I') = \psi(I,I') C_y(I,I')\) More...
 
double mating_probability_debarre (const Individual &male) const
 \(P(I,I') = \psi(I,I') C_y(I,I')\) with Debarre 2012 More...
 
double mating_probability_TPG2013 (const Individual &male) const
 \(P(I,I') = \psi(I,I') C_y(I,I')\) with Thibert-Plante and Gavrilets 2013 More...
 
std::vector< Locigametogenesis (URBG &) const
 Gametogenesis with free recombination and mutation. More...
 
bool is_male () const
 Get sex_.
 
void change_sex ()
 Change sex_.
 
bool operator< (const Individual &other) const
 Operator required to be std::map key.
 
std::string str_detail () const
 detailed str() for testing/debugging
 

Static Public Member Functions

static std::string header ()
 The header correspongs to str()
 
static void write_resource_abundance ()
 test function
 
static std::string possible_phenotypes ()
 test function
 
static std::string possible_geographic ()
 test function
 
static void param (const param_type &p)
 Set PARAM_.
 
static const param_typeparam ()
 Get PARAM_.
 

Private Member Functions

double habitat_preference_exp (const double height, const double diameter) const
 Exponent of \(\Xi(I, u, v)\) in anolis_v2. More...
 
double habitat_preference_quadratic (const double height, const double diameter) const
 \(\Xi(I, u, v)\) quadratic approximation in anolis_v3 More...
 
double calc_DI_analytical () const
 \(D_I\) analytical computation by Mathematica (fast but limited) More...
 
double calc_DI_numerical () const
 \(D_I\) numerical computation (slow) More...
 
double calc_Dxi_analytical () const
 Calculate quadratic \(\Xi(I, u, v)\) normalizer with analytical solution. More...
 
double calc_Dxi_numerical () const
 Numerical integration of quadratic \(\xi(I, u, v)\). More...
 
double fitness (const double height, const double diameter) const
 Exponent of \(W(x_0, x_1 \mid u, v)\): measure adaptation to habitat. More...
 
std::vector< double > calc_phenotype () const
 calculates phenotypic values from genotype More...
 
std::vector< double > intermediate_phenotypes () const
 aggregation of intermediate phenotype values
 

Private Attributes

std::pair< std::vector< Loci >, std::vector< Loci > > genotype_
 Unlinked diallelic loci with equal effects.
 
std::vector< double > phenotype_
 All traits are scaled to be between 0 and 1.
 
bool sex_ = false
 female=0, male=1
 
double ke_
 \(K_e(I)\) calculated in advance
 

Static Private Attributes

static constexpr size_t NUM_LOCI_ = 8
 The number of loci per trait.
 
static constexpr unsigned long FULL_BITS = (1u << NUM_LOCI_) - 1u
 Genotype that produce trait value = 1.0, i.e., 11111111
 
static constexpr unsigned long HALF_BITS = (1u << (NUM_LOCI_ / 2u)) - 1u
 Genotype that produce trait value = 0.5, i.e., 00001111
 
static constexpr double INV_NUM_LOCI_ = 0.5 / NUM_LOCI_
 Compile-time constant value used in init_phenotype()
 
static constexpr size_t NUM_STEPS_ = 32
 Precision of numerical integration.
 
static std::map< std::vector< double >, double > KE_CACHE_
 Store \(K_e(I)\) with ecological traits as keys.
 
static const std::vector< std::string > INTERMEDIATE_KEYS_
 labels for intermediate phenotypes More...
 
static param_type PARAM_
 Parameters shared among instances.
 

Friends

std::ostream & operator<< (std::ostream &ost, const Individual &ind)
 put CSV on ostream
 
double pdf_beta (const double height, const double diameter)
 Beta distribution function for resource abundance.
 
double pdf_normal (const double height, const double diameter)
 Distribution of tree height given diameter.
 
double pdf_exp (const double height, const double diameter)
 Distribution of twig diameter given height.
 
template<class Func >
double integrate_triangle (Func &&func)
 Integral over \(0 \leq u \leq 1\) and \(0 \leq v \leq 1 - u\).
 
template<class Func >
double integrate_square (Func &&func)
 Integral over \(0 \leq u,v \leq 1\).
 

Detailed Description

sexual, diploid, additive, unlinked, diallelic

Individuals are sexual and diploid. Each individual has a number of additive quantitative characters:

The male display trait \( m \) is expressed in males only, whereas female mating preference \( f \) and tolerance \( c \) are expressed in females only. Other traits are expressed in both sexes. All traits are scaled to be between 0 and 1, and are controlled by different unlinked diallelic loci with equal effects. Mutations occur at equal rates across all loci; the probabilities of forward and backward mutations are equal.

Member Function Documentation

◆ calc_phenotype()

std::vector<double> edal::Individual::calc_phenotype ( ) const
inlineprivate

calculates phenotypic values from genotype

Returns
phenotypic values

Member Data Documentation

◆ INTERMEDIATE_KEYS_

const std::vector< std::string > edal::Individual::INTERMEDIATE_KEYS_
staticprivate
Initial value:
= {
"Ke_v3u", "Ke_v3eu", "Ke_oeu", "DI_a", "DI",
"Dxi_a", "Dxi", "Dxi_e", "Dxi_oe"
}

labels for intermediate phenotypes


The documentation for this class was generated from the following files: