Ejemplo n.º 1
0
    public Generation nextGeneration()
    {
        Generation nextGeneration;

        if (generations.getGenerations().Count == 0)
        {
            nextGeneration = generations.firstGeneration();
        }
        else
        {
            nextGeneration = generations.nextGeneration();
        }

        if (lowHistoric)
        {
            if (generations.getGenerations().Count >= 2)
            {
                List <Genome> genomes = generations.getGenerations() [generations.getGenerations().Count - 1].getGenomes();
                for (int i = 0; i < genomes.Count; i++)
                {
                    genomes [i].deleteNeuralNetwork();
                }
            }
        }

        if (historic != -1)
        {
            if (generations.getGenerations().Count > historic + 1)
            {
                generations.getGenerations().RemoveRange(0, generations.getGenerations().Count - (historic + 1));
            }
        }

        return(nextGeneration);
    }