public static IndividualFactory getInstance() { if (instance == null) { instance = new IndividualFactory(); } return(instance); }
public EvolutionaryProcess(IGUI _program, string _problem) { program = _program; problem = _problem; IndividualFactory.getInstance().Init(problem); population = new List <Individual>(); for (int i = 0; i < Parameters.individualsNb; i++) { population.Add(IndividualFactory.getInstance().getIndividual (problem)); } }
private void Reproduction() { bool twoParents = (Parameters.randomGenerator.NextDouble() < Parameters.crossoverRate); if (twoParents) { Individual father = Selection(); Individual mother = Selection(); newGeneration.Add(IndividualFactory.getInstance(). getIndividual(problem, father, mother)); } else { Individual father = Selection(); newGeneration.Add(IndividualFactory.getInstance(). getIndividual(problem, father)); } }