Closed TankredO closed 7 years ago
I think m_Variance is simply a parameter that controls the attraction to the trait mean? If you set it wider, it the trait distribution within a species will become wider.
The whole procedure was introduced to make sure infraspecific variability remains smaller than interspecific trait variability.
The m_Variance variable controls only the "width" of the environmental niche niche. Maybe this should be renamed?
Right now the fitness can take values above 1. According to the mortality based reproduction, an individual can't die when its fitness is greater than or equal to 1. However, we are staying in this while loop till we reach numerOfRuns deaths. This seems to me like a huge ressource sink. The m_mortalityStrength variable tries to solve this problem. Every m_mortalityStrength'th step the randomly chosen individual dies, no matter its fitness. Still all steps in between can potentially "get stuck" for a long time.
about m_Variance - no, that's not the niche, it's the within species trait attraction during evolution, something very different. I'll open another threat for the mortality problem.
About the variance - we could still rename it, I guess it's not a particularly good name. I also wonder if it is properly document - can this parameter be changed from R? Might be nice.
The variable is hardcoded in c++ at the moment.
I am not sure about the trait attraction. The variable (variance) is only used for the calculation of the fitness. The evolution method has its own width variable.
void Individual::evolve() {
//if (m_X_coordinate == 0 && m_Y_coordinate == 0) printInfo();
double width = 0.01;
double upperBound = 1.0;
double lowerBound = 0.0;
double weightSpecies = 0.2;
// Environment
m_Mean = (1.0 - weightSpecies) * m_Mean + weightSpecies * m_Species->m_Mean +
m_RandomGenerator.randomDouble(-width, width);
if (m_Mean > upperBound) m_Mean = upperBound - (m_Mean - upperBound);
else if (m_Mean < lowerBound) m_Mean = lowerBound + std::abs(m_Mean);
// Competition
m_CompetitionMarker = (1.0 - weightSpecies) * m_CompetitionMarker + weightSpecies * m_Species->m_CompetitionMean +
m_RandomGenerator.randomDouble(-width, width);
if (m_CompetitionMarker > upperBound) m_CompetitionMarker = upperBound - (m_CompetitionMarker - upperBound);
else if (m_CompetitionMarker < lowerBound) m_CompetitionMarker = lowerBound + std::abs(m_CompetitionMarker);
//Neutral
m_NeutralMarker = (1.0 - weightSpecies) * m_NeutralMarker + weightSpecies * m_Species->m_NeutralMean +
m_RandomGenerator.randomDouble(-width, width);
if (m_NeutralMarker > upperBound) m_NeutralMarker = upperBound - (m_NeutralMarker - upperBound);
else if (m_NeutralMarker < lowerBound) m_NeutralMarker = lowerBound + std::abs(m_NeutralMarker);
reportBirth(); // ATTENTION: reportBirth is called here!
}
I would multiply instead of dividing in the Gauss function - then you have a parameter that is 1/m_variance, and it would make sense to call this parameter "intraspecificTraitAttraction".
Ah, shit, sorry ... ok, then this is the niche width after all. Then maybe better call it niche width
efb4cffb24d571f4058aa6429462021915c891ad
When new individuals are added to or removed from a species, the trait means are updated, but the variance is not. Is there a reason for this? It seems to me that the the variance values are never changed, but are used in the fitness calculation in Individuals.cpp: