1 10 package org.jgap.distr.grid; 11 12 import org.homedns.dade.jcgrid.*; 13 import org.homedns.dade.jcgrid.worker.*; 14 import org.jgap.*; 15 import org.jgap.distr.grid.*; 16 17 25 public class JGAPWorker 26 implements Worker { 27 28 private final static String CVS_REVISION = "$Revision: 1.7 $"; 29 30 41 public WorkResult doWork(WorkRequest work, String workDir) 42 throws Exception { 43 JGAPRequest req = ( (JGAPRequest) work); 44 45 46 Configuration conf = req.getConfiguration(); 49 conf = conf.newInstance(conf.getId() + "_1", conf.getName() + "_1"); 50 req.setConfiguration(conf); 53 Genotype gen = null; 54 if (req.getGenotypeInitializer() != null) { 57 Population initialPop = req.getPopulation(); 60 gen = req.getGenotypeInitializer().setupGenotype(req, initialPop); 61 if (req.getWorkerEvolveStrategy() != null) { 62 req.getWorkerEvolveStrategy().evolve(gen); 65 } 66 } 67 WorkResult res = req.getWorkerReturnStrategy().assembleResult(req, gen); 70 return res; 71 } 72 73 82 public static void main(String [] args) 83 throws Exception { 84 new JGAPWorkers(args); 87 } 88 } 89 | Popular Tags |