1 10 package examples.grid.evolutionDistributed; 11 12 import org.jgap.distr.grid.*; 13 import org.jgap.*; 14 15 public class MyGenotypeInitializer 16 implements IGenotypeInitializer { 17 18 private final static String CVS_REVISION = "$Revision: 1.1 $"; 19 20 public Genotype setupGenotype(JGAPRequest a_req, Population a_initialPop) 21 throws Exception { 22 Configuration conf = a_req.getConfiguration(); 23 Population pop; 24 if (a_initialPop == null) { 25 pop = new Population(conf); 26 } 27 else { 28 pop = a_initialPop; 29 } 30 int size = conf.getPopulationSize() - pop.size(); 31 Genotype result = new Genotype(conf, pop); 32 result.fillPopulation(size); 33 return result; 34 } 35 } 36 | Popular Tags |