Ejemplo n.º 1
0
 public static IndividualFactory getInstance()
 {
     if (instance == null)
     {
         instance = new IndividualFactory();
     }
     return(instance);
 }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
        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));
            }
        }