Beispiel #1
0
 public SimplePopulation sampleNewPopulation(SimplePopulation pop) {
   SimplePopulation newPop = pop.getCleanClone();
   BinaryString template = (BinaryString) pop.getIndividual(0);
   for (int i = 0; i < offspringSize; i++) {
     newPop.addIndividual(generateInstance(template));
   }
   return newPop;
 }
Beispiel #2
0
 public static Population getPopulation(SimplePopulation pop) {
   Population newPop = new SelectedSet(pop.getNumberOfIndividuals());
   newPop.individuals = new Individual[pop.getNumberOfIndividuals()];
   for (int i = 0; i < newPop.individuals.length; i++) {
     newPop.individuals[i] = new Individual((BinaryString) pop.getIndividual(i));
   }
   newPop.computeUnivariateFrequencies();
   return newPop;
 }