public override void InitPopulation() { maxNumberOfEvaluations = Mathf.Min(maxNumberOfEvaluations, populationSize); populationRed = new List <Individual>(); populationBlue = new List <Individual>(); while (populationRed.Count < populationSize) { GeneticIndividual new_ind_red = new GeneticIndividual(NNTopology, maxNumberOfEvaluations, mutationMethod) { Mean = Mean, Stdev = Stdev }; GeneticIndividual new_ind_blue = new GeneticIndividual(NNTopology, maxNumberOfEvaluations, mutationMethod) { Mean = Mean, Stdev = Stdev }; if (seedPopulationFromFile) { NeuralNetwork nnRed = getRedIndividualFromFile(); NeuralNetwork nnBlue = getBlueIndividualFromFile(); new_ind_red.Initialize(nnRed); new_ind_blue.Initialize(nnBlue); //only the first individual is an exact copy. the other are going to suffer mutations if (populationRed.Count != 0 && populationBlue.Count != 0) { new_ind_red.Mutate(mutationProbabilityRedPopulation); new_ind_blue.Mutate(mutationProbabilityBluePopulation); } } else { new_ind_red.Initialize(); new_ind_blue.Initialize(); } populationRed.Add(new_ind_red); populationBlue.Add(new_ind_blue); } switch (selectionMethod) { case SelectionType.Tournament: selection = new TournamentSelection(tournamentSize); break; } }
public override void InitPopulation() { //You should implement the code to initialize the population here population = new List <Individual>(); while (population.Count < populationSize) { GeneticIndividual new_ind = new GeneticIndividual(topology); new_ind.Initialize(); population.Add(new_ind); } }
public override void InitPopulation() { population = new List <Individual>(); while (population.Count < populationSize) { GeneticIndividual gene = new GeneticIndividual(topology); gene.Initialize(); population.Add(gene); } Debug.Log("-------------------------------INITIALIZATION END -------------------------------"); }
public override void InitPopulation() { population = new List <Individual>(); // jncor while (population.Count < populationSize) { GeneticIndividual new_ind = new GeneticIndividual(topology); new_ind.Initialize(); population.Add(new_ind); } }
public override void InitPopulation() { //You should implement the code to initialize the population //tournmentsize atribuido ja this.population = new List <Individual>(); for (int i = 0; i < populationSize; i++) { GeneticIndividual a = new GeneticIndividual(this.topology); a.Initialize(); this.population.Add(a); } }
// Função alterada, original em baixo public override void InitPopulation() { population = new List <Individual>(); Debug.Log("Estou a inicializar a população no Genetic"); // jncor while (population.Count < populationSize) { GeneticIndividual new_ind = new GeneticIndividual(topology); new_ind.Initialize(); population.Add(new_ind); } Debug.Log("População inicializada"); Debug.Log("Valor" + numeroValoresPreservados); }