Exemplo n.º 1
0
        public void ResetPopulation(GenomeList l, EvolutionAlgorithm ea)
        {
            speciesToRemove.Clear();

            foreach (Species species in speciesTable.Values)
            {
                speciesToRemove.Add(species.SpeciesId);
            }

            int speciesBound = speciesToRemove.Count;

            for (int speciesIdx = 0; speciesIdx < speciesBound; speciesIdx++)
            {
                speciesTable.Remove(speciesToRemove[speciesIdx]);
            }

            for (int i = 0; i < l.Count; i++)
            {
                this.AddGenomeToPopulation(ea, l[i]);
            }

            this.RebuildGenomeList();
        }
Exemplo n.º 2
0
 public Population(IdGenerator idGenerator, GenomeList genomeList)
 {
     this.idGenerator    = idGenerator;
     this.genomeList     = genomeList;
     this.populationSize = genomeList.Count;
 }