Ejemplo 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);
 }
Ejemplo n.º 2
0
 public IDistribution <bool> DeathDistribution(int currentPopulation) =>
 Bernoulli.Distribution(this.deathProbabilityPerCreaturePerStep + this.crowdingCoefficient * currentPopulation);