Esempio n. 1
0
 public Creature(
     CreatureType type,
     double spontaneousBirthProbabilityPerStep,
     double deathProbabilityPerCreaturePerStep,
     double crowdingCoefficient,
     double replicationProbabilityPerStep,
     IReadOnlyDictionary <CreatureType, double> mutationWeights)
 {
     this.deathProbabilityPerCreaturePerStep = deathProbabilityPerCreaturePerStep;
     this.crowdingCoefficient = crowdingCoefficient;
     this.Type = type;
     this.SpontaneousBirthDistribution = Bernoulli.Distribution(spontaneousBirthProbabilityPerStep);
     this.ReplicationDistribution      = Bernoulli.Distribution(replicationProbabilityPerStep);
     this.MutationDistribution         = new Weighted <CreatureType>(mutationWeights);
 }
Esempio n. 2
0
 public IDistribution <bool> DeathDistribution(int currentPopulation) =>
 Bernoulli.Distribution(this.deathProbabilityPerCreaturePerStep + this.crowdingCoefficient * currentPopulation);