Exemplo n.º 1
0
 private void NewGeneration()
 {
     if (currentGeneration >= startRandomizingTunnelAtGeneration)
     {
         tunnelGenerator.Regenerate();
     }
     Vector <double>[] newChromosomes = new Vector <double> [populationSize];
     newChromosomes = Evolution.Breed(Evolution.SelectFittest(chromosomes, scores));
     chromosomes    = newChromosomes;
     StartGeneration();
 }
Exemplo n.º 2
0
    public void CloseGeneration()
    {
        AdvancingGeneration = true;
        EndCurrentSubject();
        int pop_size = Population.Count;

        Population = Evolution.Cull(Population, ElitePercentage);
        Debug.Log("  -------------------    Generation Results   -------------------\n");
        for (int i = 0; i < Population.Count; i += 2)
        {
            string print = $"{Population[i].fitness}";
            if (i + 1 < Population.Count)
            {
                print += $"\n{Population[i + 1].fitness}";
            }
            Debug.Log(print);
        }
        Population = Evolution.Breed(Population, pop_size, MutationFactor, MutationChance, RandomChildChance);
    }