1 10 package examples.grid.evolutionDistributed; 11 12 import java.util.*; 13 import org.jgap.*; 14 import org.jgap.distr.grid.*; 15 16 22 public class MyWorkerReturnStrategy 23 implements IWorkerReturnStrategy { 24 25 private final static String CVS_REVISION = "$Revision: 1.2 $"; 26 27 38 public JGAPResult assembleResult(JGAPRequest a_req, Genotype a_genotype) 39 throws Exception { 40 List top = a_genotype.getPopulation().determineFittestChromosomes(10); 41 Population pop = new Population(a_req.getConfiguration()); 42 for (int i = 0; i < top.size(); i++) { 43 pop.addChromosome( (IChromosome) top.get(i)); 44 } 45 JGAPResult result = new JGAPResult(a_req.getSessionName(), a_req.getRID(), 46 pop, 1); 47 return result; 48 } 49 } 50 | Popular Tags |