/// <summary> /// Create an initial random population. /// </summary> public void Reset() { // create the genome factory if (IsHyperNEAT) { CODEC = new HyperNEATCODEC(); GenomeFactory = new FactorHyperNEATGenome(); } else { CODEC = new NEATCODEC(); GenomeFactory = new FactorNEATGenome(); } // create the new genomes Species.Clear(); // reset counters GeneIdGenerate.CurrentID = 1; InnovationIDGenerate.CurrentID = 1; EncogRandom rnd = RandomNumberFactory.Factor(); // create one default species BasicSpecies defaultSpecies = new BasicSpecies(); defaultSpecies.Population = this; // create the initial population for (int i = 0; i < PopulationSize; i++) { NEATGenome genome = GenomeFactory.Factor(rnd, this, InputCount, OutputCount, InitialConnectionDensity); defaultSpecies.Add(genome); } defaultSpecies.Leader = defaultSpecies.Members[0]; Species.Add(defaultSpecies); // create initial innovations Innovations = new NEATInnovationList(this); }
/// <summary> /// Create an initial random population. /// </summary> public void Reset() { // create the genome factory if (IsHyperNEAT) { CODEC = new HyperNEATCODEC(); GenomeFactory = new FactorHyperNEATGenome(); } else { CODEC = new NEATCODEC(); GenomeFactory = new FactorNEATGenome(); } // create the new genomes Species.Clear(); // reset counters GeneIdGenerate.CurrentID = 1; InnovationIDGenerate.CurrentID = 1; EncogRandom rnd = RandomNumberFactory.Factor(); // create one default species BasicSpecies defaultSpecies = new BasicSpecies(); defaultSpecies.Population = this; // create the initial population for (int i = 0; i < PopulationSize; i++) { NEATGenome genome = GenomeFactory.Factor(rnd, this , InputCount, OutputCount, InitialConnectionDensity); defaultSpecies.Add(genome); } defaultSpecies.Leader = defaultSpecies.Members[0]; Species.Add(defaultSpecies); // create initial innovations Innovations = new NEATInnovationList(this); }