Nemo
2.3.56
Simulate forward-in-time genetic evolution in a spatially explicit, individual-based stochastic simulator
|
Composite LCE implementing breeding and viability selection on a given trait type. More...
#include <LCEcomposite.h>
Public Member Functions | |
LCE_Breed_Selection () | |
virtual | ~LCE_Breed_Selection () |
bool | setNonSelectedTraitTable () |
Builds the vector of traits not under selection. More... | |
Individual * | makeOffspringWithSelection (Individual *ind, unsigned int natalpatch) |
Performs viability selection and breeding at the same time. More... | |
void | do_breed_selection_FecFitness (Patch *patch, unsigned int patchID, unsigned int *cntr) |
void | do_breed_selection_OffSurvival (Patch *patch, unsigned int patchID, unsigned int *cntr) |
void | do_breed_selection_WrightFisher_2sex (Patch *patch, unsigned int patchID, unsigned int *cntr) |
void | do_breed_selection_WrightFisher_1sex (Patch *patch, unsigned int patchID, unsigned int *cntr) |
void | setReproScaledFitness_sum (sex_t SEX, valarray< double > &survival, unsigned int numReproFem, Patch *patch) |
Implementations | |
virtual bool | setParameters () |
virtual void | execute () |
virtual LifeCycleEvent * | clone () |
virtual void | loadFileServices (FileServices *loader) |
virtual void | loadStatServices (StatServices *loader) |
virtual bool | resetParameterFromSource (std::string param, SimComponent *cmpt) |
virtual age_t | removeAgeClass () |
virtual age_t | addAgeClass () |
virtual age_t | requiredAgeClass () |
![]() | |
LCE_Breed_base () | |
virtual | ~LCE_Breed_base () |
virtual Individual * | getFatherPtr (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Calls the mating function according to the model chosen using the function pointer, used to get the father from the mother in a patch. More... | |
void | NonWrightFisherPopulation () |
void | WrightFisherPopulation () |
Individual * | breed (Individual *mother, Individual *father, unsigned int LocalPatch) |
Makes a new individual with the right parents. More... | |
Individual * | breed_cloning (Individual *mother, Individual *father, unsigned int LocalPatch) |
Makes a new individual by doing a deep copy of the mother (copies the mother's genes into the offspring). More... | |
Individual * | makeOffspring (Individual *ind) |
Last step of the breeding process, does inheritance and mutation of the parents' genes. More... | |
Individual * | do_breed (Individual *mother, Individual *father, unsigned int LocalPatch) |
Calls the breeding function unsing its pointer. More... | |
bool | checkMatingCondition (Patch *thePatch) |
Checks if any mating will take place in the patch passed as argument. More... | |
bool | checkNoSelfing (Patch *thePatch) |
Checks whether mating will take place in the current patch when mating is not selfing or cloning. More... | |
bool | checkPolygyny (Patch *thePatch) |
Checks whether mating will take place in the current patch when mating is polygynous. More... | |
bool | checkSelfing (Patch *thePatch) |
Checks whether mating will take place in the current patch when mating is selfing. More... | |
bool | checkCloning (Patch *thePatch) |
Checks whether mating will take place in the current patch when mating is cloning. More... | |
bool | setMatingSystem () |
bool | setFecundity () |
bool | setSexRatio () |
double | getMatingProportion () |
double | getMeanFecundity (unsigned int patch) |
int | getMatingSystem () |
bool | doInheritance () |
double | getPoissonFecundity (double mean) |
double | getFixedFecundity (double mean) |
double | getGaussianFecundity (double mean) |
double | getLogNormalFecundity (double mean) |
double | getFecundity (unsigned int patch) |
double | getFecundity (double mean) |
sex_t | getOffsprgSex () |
sex_t | getOffsprgSexRandom () |
sex_t | getOffsprgSexFixed () |
sex_t | getOffsprgSexSelfing () |
sex_t | getOffsprgSexCloning () |
Individual * | RandomMating (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to a male drawn randomly from a patch. More... | |
Individual * | fullPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to the alpha male of the patch. More... | |
Individual * | fullPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to one of the first _mating_males males of the patch. More... | |
Individual * | partialPolyginy (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or the first male otherwise. More... | |
Individual * | partialPolyginy_manyMales (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to a male from a patch chosen at random if _mating_proportion != 1, or one of the _mating_males first males otherwise. More... | |
Individual * | fullMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to a male with same index as mother (if available) from the focal patch. More... | |
Individual * | partialMonoginy (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a pointer to a male with same index as mother (if available) from the focal patch. More... | |
Individual * | fullSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns the mother pointer. More... | |
Individual * | partialSelfing (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns the mother pointer or a random female if _mating_proportion != 1. More... | |
Individual * | random_hermaphrodite (Patch *thePatch, Individual *mother, unsigned int motherIndex) |
Returns a random female from the patch, will be the same mother with probability 1/N (Wright-Fisher model). More... | |
![]() | |
LifeCycleEvent (const char *name, const char *trait_link) | |
Cstor. More... | |
virtual | ~LifeCycleEvent () |
virtual void | init (Metapop *popPtr) |
Sets the pointer to the current Metapop and the trait link if applicable. More... | |
virtual bool | attach_trait (string trait) |
virtual void | set_paramset (std::string name, bool required, SimComponent *owner) |
virtual void | set_event_name (std::string &name) |
Set the name of the event (name of the ParamSet) and add the corresponding parameter to the set. More... | |
virtual void | set_event_name (const char *name) |
virtual string & | get_event_name () |
Accessor to the LCE's name. More... | |
virtual int | get_rank () |
Accessor to the LCE rank in the life cycle. More... | |
virtual void | set_pop_ptr (Metapop *popPtr) |
Accessors for the population pointer. More... | |
virtual Metapop * | get_pop_ptr () |
![]() | |
SimComponent () | |
virtual | ~SimComponent () |
virtual void | loadUpdaters (UpdaterServices *loader) |
Loads the parameters and component updater onto the updater manager. More... | |
virtual void | set_paramset (ParamSet *paramset) |
Sets the ParamSet member. More... | |
virtual void | set_paramsetFromCopy (const ParamSet &PSet) |
Reset the set of parameters from a another set. More... | |
virtual ParamSet * | get_paramset () |
ParamSet accessor. More... | |
virtual void | add_parameter (Param *param) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd) |
Interface to add a parameter to the set. More... | |
virtual void | add_parameter (std::string Name, param_t Type, bool isRequired, bool isBounded, double low_bnd, double up_bnd, ParamUpdaterBase *updater) |
Interface to add a parameter and its updater to the set. More... | |
virtual Param * | get_parameter (std::string name) |
Param getter. More... | |
virtual double | get_parameter_value (std::string name) |
Param value getter. More... | |
virtual string | get_name () |
Returnd the name of the ParamSet, i.e. More... | |
virtual bool | has_parameter (std::string name) |
Param getter. More... | |
![]() | |
LCE_Selection_base () | |
virtual | ~LCE_Selection_base () |
bool | setSelectionMatrix () |
bool | setLocalOptima () |
bool | set_sel_model () |
bool | set_fit_model () |
bool | set_local_optima () |
bool | set_param_rate_of_change () |
void | set_std_rate_of_change () |
void | addPhenotypicSD (unsigned int deme, double *stDev) |
void | changeLocalOptima () |
void | resetCounters () |
Resets the fitness counters. More... | |
void | setMeans (unsigned int tot_ind) |
Computes the average fitness of each pedigree class. More... | |
double | getMeanFitness (age_idx age) |
Computes the mean fitness of the whole population for a given age class. More... | |
double | getMeanPatchFitness (age_idx age, unsigned int p) |
Computes the mean fitness in a given patch for a given age class. More... | |
double | getMaxFitness (age_idx age) |
Computes the maximum fitness value of the whole population for a given age class. More... | |
double | getMaxPatchFitness (age_idx age, unsigned int p) |
Computes the maximum fitness value in a given patch for a given age class. More... | |
double | setMeanFitness (age_idx age) |
Sets the _mean_fitness variable to the value of the mean population fitness. More... | |
double | getFitness (Individual *ind, unsigned int patch) |
Calls the fitness function according to the fitness model. More... | |
double | getFitnessFixedEffect (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual in the fixed selection model. More... | |
double | getFitnessDirect (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual following the direct selection model. More... | |
double | getFitnessUnivariateQuadratic (Individual *ind, unsigned int patch, unsigned int trait) |
Quadratic fitness surface, approximates the Gaussian model for weak selection and/or small deviation from the optimum. More... | |
double | getFitnessMultivariateGaussian (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual following the Gaussian selection model with one trait under selection. More... | |
double | getFitnessUnivariateGaussian (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual following the Gaussian selection model with several traits under selection. More... | |
double | getFitnessMultivariateGaussian_VE (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual following the Gaussian selection model with one trait under selection and environmental variance. More... | |
double | getFitnessUnivariateGaussian_VE (Individual *offsprg, unsigned int patch, unsigned int trait) |
Returns the fitness of an individual following the Gaussian selection model with several traits under selection and environmental variance. More... | |
double | getFitnessAbsolute (Individual *ind, unsigned int patch) |
Returns the raw fitness of the individual, without adjustment (absolute fitness). More... | |
double | getFitnessRelative (Individual *ind, unsigned int patch) |
Returns the relative fitness of the individual, adjusted by a scaling factor. More... | |
void | setScalingFactorLocal (age_idx age, unsigned int p) |
Sets the fitness scaling factor equal to the inverse of the mean local patch fitness. More... | |
void | setScalingFactorGlobal (age_idx age, unsigned int p) |
Sets the fitness scaling factor equal to the inverse of the mean population fitness. More... | |
void | setScalingFactorMaxLocal (age_idx age, unsigned int p) |
Sets the fitness scaling factor equal to the inverse of the maximum local patch fitness value. More... | |
void | setScalingFactorMaxGlobal (age_idx age, unsigned int p) |
Sets the fitness scaling factor equal to the inverse of the maximum population fitness value. More... | |
void | setScalingFactorAbsolute (age_idx age, unsigned int p) |
Resets the fitness scaling factor equal to one. More... | |
void | doViabilitySelection (sex_t SEX, age_idx AGE, Patch *patch, unsigned int p) |
Selectively removes individuals in the population depending on their fitness. More... | |
Private Attributes | |
void(LCE_Breed_Selection::* | _breed_selection )(Patch *patch, unsigned int patchID, unsigned int *cntr) |
unsigned int | _nb_trait |
vector< unsigned int > | _nonSelectedTraitIndices |
Additional Inherited Members | |
![]() | |
void(LCE_Breed_base::* | PopModelFuncPtr )(void) |
TMatrix | _mean_fecundity |
![]() | |
std::string | _event_name |
The param name to be read in the init file. More... | |
Metapop * | _popPtr |
The ptr to the current Metapop. More... | |
std::string | _LCELinkedTraitType |
The name of the linked trait. More... | |
int | _LCELinkedTraitIndex |
The index in the individual's trait table of the linked trait. More... | |
![]() | |
ParamSet * | _paramSet |
The parameters container. More... | |
![]() | |
double | _letheq |
double | _base_fitness |
double | _mean_fitness |
double | _max_fitness |
double | _scaling_factor |
bool | _is_local |
bool | _is_absolute |
double | _fitness [5] |
Fitness counters, one for each pedigree class. More... | |
double | _survival [5] |
double | _ind_cntr [5] |
vector< string > | _Traits |
The list of trait types under selection. More... | |
vector< unsigned int > | _TraitIndices |
The indices of the traits under selection. More... | |
vector< string > | _SelectionModels |
The selection models associated with each trait under selection. More... | |
LCE_SelectionSH * | _stater |
LCE_SelectionFH * | _writer |
int | _selectTraitDimension |
Number of quantitative traits under selection. More... | |
vector< double > | _selection_variance |
Patch-specific selection variance. More... | |
double | _eVariance |
Evironmental variance. More... | |
vector< double(LCE_Selection_base::*)(Individual *, unsigned int, unsigned int) > | _getRawFitness |
A vector containing pointers to fitness function related to each trait under selection. More... | |
double(LCE_Selection_base::* | _getFitness )(Individual *, unsigned int) |
Pointer to the function returning the individual fitness. More... | |
void(LCE_Selection_base::* | _setScalingFactor )(age_idx, unsigned int) |
Pointer to the function used to set the fitness scaling factor when fitness is relative. More... | |
void(LCE_Selection_base::* | _setNewLocalOptima )(void) |
Pointer to the function used to change the local phenotypic optima or its rate of change. More... | |
Composite LCE implementing breeding and viability selection on a given trait type.
Inherits from LCE_Breed_base and LCE_Selection_base.
LCE_Breed_Selection::LCE_Breed_Selection | ( | ) |
References SimComponent::add_parameter(), and BOOL.
Referenced by clone().
|
inlinevirtual |
|
inlinevirtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References OFFSPRG.
|
inlinevirtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References LCE_Breed_Selection().
void LCE_Breed_Selection::do_breed_selection_FecFitness | ( | Patch * | patch, |
unsigned int | patchID, | ||
unsigned int * | cntr | ||
) |
References LCE_Selection_base::_fitness, LCE_Selection_base::_ind_cntr, LCE_Selection_base::_setScalingFactor, LCE_Selection_base::_survival, Patch::add(), ADLTx, LCE_Breed_base::do_breed(), FEM, Patch::get(), LCE_Breed_base::getFatherPtr(), LCE_Breed_base::getFecundity(), LCE_Selection_base::getFitness(), LCE_Breed_base::getMeanFecundity(), Individual::getPedigreeClass(), Individual::getSex(), LCE_Breed_base::makeOffspring(), OFFSx, Individual::setFecundity(), and Patch::size().
Referenced by setParameters().
void LCE_Breed_Selection::do_breed_selection_OffSurvival | ( | Patch * | patch, |
unsigned int | patchID, | ||
unsigned int * | cntr | ||
) |
References Patch::add(), ADLTx, LCE_Breed_base::do_breed(), FEM, Patch::get(), LCE_Breed_base::getFatherPtr(), LCE_Breed_base::getFecundity(), Individual::getSex(), makeOffspringWithSelection(), OFFSx, Individual::setFecundity(), and Patch::size().
Referenced by setParameters().
void LCE_Breed_Selection::do_breed_selection_WrightFisher_1sex | ( | Patch * | patch, |
unsigned int | patchID, | ||
unsigned int * | cntr | ||
) |
References Patch::add(), ADLTx, LCE_Breed_base::do_breed(), FEM, Patch::get(), Patch::get_K(), LCE_Breed_base::makeOffspring(), MAL, RAND::MultinomialOnNormalizedValarray_scrambleOut(), OFFSx, setReproScaledFitness_sum(), Individual::setSex(), and Patch::size().
Referenced by setParameters().
void LCE_Breed_Selection::do_breed_selection_WrightFisher_2sex | ( | Patch * | patch, |
unsigned int | patchID, | ||
unsigned int * | cntr | ||
) |
References Patch::add(), ADLTx, LCE_Breed_base::do_breed(), FEM, Patch::get(), Patch::get_K(), LCE_Breed_base::makeOffspring(), MAL, RAND::MultinomialOnNormalizedValarray_scrambleOut(), OFFSx, setReproScaledFitness_sum(), Individual::setSex(), and Patch::size().
Referenced by setParameters().
|
virtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References _breed_selection, LCE_Selection_base::_mean_fitness, LifeCycleEvent::_popPtr, LCE_Selection_base::_scaling_factor, ADULTS, LCE_Breed_base::checkMatingCondition(), Metapop::flush(), Metapop::getPatch(), Metapop::getPatchNbr(), message(), OFFSPRG, OFFSx, LCE_Selection_base::resetCounters(), LCE_Selection_base::setMeans(), Metapop::size(), and warning().
|
inlinevirtual |
|
virtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References LCE_Selection_base::loadStatServices().
Individual * LCE_Breed_Selection::makeOffspringWithSelection | ( | Individual * | ind, |
unsigned int | natalpatch | ||
) |
Performs viability selection and breeding at the same time.
The selected trait is first inherited (with recombination and mutations) and survival checked before the remaining traits are inherited. This helps save some computing time. The function returns a null pointer in case of selective death.
ind | the newborn, its new traits have not been computed yet |
natalpatch | the index of the natal patch of the offfspring where selectin takes palce |
References LCE_Selection_base::_fitness, LCE_Selection_base::_ind_cntr, _nonSelectedTraitIndices, LifeCycleEvent::_popPtr, LCE_Selection_base::_survival, LCE_Selection_base::_TraitIndices, Individual::addMating(), Individual::createTrait(), Individual::DidHaveABaby(), LCE_Breed_base::doInheritance(), fatal(), Individual::getFather(), LCE_Selection_base::getFitness(), Individual::getMother(), Individual::getPedigreeClass(), IndFactory::recycle(), and RAND::Uniform().
Referenced by LCE_Breed_Selection_Disperse::do_breed(), and do_breed_selection_OffSurvival().
|
inlinevirtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References NONE.
|
inlinevirtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References ADULTS.
|
inlinevirtual |
Reimplemented from LCE_Selection_base.
Reimplemented in LCE_Breed_Selection_Disperse.
bool LCE_Breed_Selection::setNonSelectedTraitTable | ( | ) |
Builds the vector of traits not under selection.
Used in LCE_Breed_Selection_Disperse as well.
References _nb_trait, _nonSelectedTraitIndices, LifeCycleEvent::_popPtr, LCE_Selection_base::_TraitIndices, error(), IndFactory::getIndividualProtoype(), and Individual::getTraitNumber().
Referenced by setParameters(), and LCE_Breed_Selection_Disperse::setParameters().
|
virtual |
Reimplemented from LCE_Breed_base.
Reimplemented in LCE_Breed_Selection_Disperse.
References _breed_selection, do_breed_selection_FecFitness(), do_breed_selection_OffSurvival(), do_breed_selection_WrightFisher_1sex(), do_breed_selection_WrightFisher_2sex(), error(), SimComponent::get_parameter(), SimComponent::get_parameter_value(), LCE_Breed_base::getMeanFecundity(), setNonSelectedTraitTable(), LCE_Breed_base::setParameters(), and LCE_Selection_base::setParameters().
void LCE_Breed_Selection::setReproScaledFitness_sum | ( | sex_t | SEX, |
valarray< double > & | survival, | ||
unsigned int | numReproFem, | ||
Patch * | patch | ||
) |
References LCE_Selection_base::_scaling_factor, ADLTx, Patch::get(), LCE_Selection_base::getFitness(), and Patch::getID().
Referenced by do_breed_selection_WrightFisher_1sex(), and do_breed_selection_WrightFisher_2sex().
|
private |
Referenced by execute(), and setParameters().
|
private |
Referenced by setNonSelectedTraitTable().
|
private |
Referenced by makeOffspringWithSelection(), and setNonSelectedTraitTable().