public override void Execute(PopulationBase population, out IndividualBase chosenIndividual1, out IndividualBase chosenIndividual2) { IndividualBase[] selectedParents = new IndividualBase[2]; for (int individualIdx = 0; individualIdx < 2; ++individualIdx) { selectedParents[individualIdx] = population.GetRandomIndividual(); for (int selectionIdx = 1; selectionIdx < tourSize; ++selectionIdx) { IndividualBase randomIndividual = population.GetRandomIndividual(); if (randomIndividual.GetFitnessForObjective(Problem.MonoObjectiveGoal) > selectedParents[individualIdx].GetFitnessForObjective(Problem.MonoObjectiveGoal)) selectedParents[individualIdx] = randomIndividual; } } chosenIndividual1 = selectedParents[0]; chosenIndividual2 = selectedParents[1]; }
public void AddPopulation(PopulationBase generatedChildren) { Content.AddRange(generatedChildren.Content); }
public abstract void Execute(PopulationBase population, out IndividualBase chosenIndividual1, out IndividualBase chosenIndividual2);
public override void Execute(PopulationBase population, out IndividualBase chosenIndividual1, out IndividualBase chosenIndividual2) { throw new NotImplementedException(); }
public void AddPopulation(PopulationBase generatedChildren) { Content.AddRange(generatedChildren.Content); }