1 10 package org.jgap.distr.grid; 11 12 import org.homedns.dade.jcgrid.*; 13 import org.jgap.*; 14 import org.jgap.util.*; 15 import org.homedns.dade.jcgrid.worker.*; 16 17 23 public class JGAPRequest 24 extends WorkRequest 25 implements ICloneable { 26 27 private final static String CVS_REVISION = "$Revision: 1.8 $"; 28 29 private Configuration m_config; 30 31 private Population m_pop; 32 33 private IWorkerEvolveStrategy m_evolveStrategy; 34 35 private IWorkerReturnStrategy m_returnStrategy; 36 37 private IGenotypeInitializer m_genotypeInitializer; 38 39 private GridWorkerFeedback m_workerFeedback; 40 41 52 public JGAPRequest(String a_name, int a_id, Configuration a_config, 53 IWorkerEvolveStrategy a_strategy) { 54 super(a_name, a_id); 55 m_config = a_config; 56 m_evolveStrategy = a_strategy; 57 } 58 59 69 public JGAPRequest(String name, int id, Configuration a_config) { 70 this(name, id, a_config, new DefaultEvolveStrategy()); 71 } 72 73 86 public JGAPRequest(String a_name, int a_id, Configuration a_config, 87 Population a_pop, IWorkerEvolveStrategy a_strategy) { 88 this(a_name, a_id, a_config, a_strategy); 89 m_pop = a_pop; 90 } 91 92 104 public JGAPRequest(String a_name, int a_id, Configuration a_config, 105 Population a_pop) { 106 this(a_name, a_id, a_config, a_pop, new DefaultEvolveStrategy()); 107 } 108 109 118 public void setEvolveStrategy(IWorkerEvolveStrategy a_evolveStrategy) { 119 m_evolveStrategy = a_evolveStrategy; 120 } 121 122 128 public IWorkerEvolveStrategy getWorkerEvolveStrategy() { 129 return m_evolveStrategy; 130 } 131 132 public void setWorkerReturnStrategy(IWorkerReturnStrategy a_strategy) { 133 m_returnStrategy = a_strategy; 134 } 135 136 142 public IWorkerReturnStrategy getWorkerReturnStrategy() { 143 return m_returnStrategy; 144 } 145 146 public GridWorkerFeedback getWorkerFeedback() { 147 return m_workerFeedback; 148 } 149 150 public void setWorkerFeedback(GridWorkerFeedback a_feedback) { 151 m_workerFeedback = a_feedback; 152 } 153 154 160 public void setGenotypeInitializer(IGenotypeInitializer a_initializer) { 161 m_genotypeInitializer = a_initializer; 162 } 163 164 165 171 public IGenotypeInitializer getGenotypeInitializer() { 172 return m_genotypeInitializer; 173 } 174 175 184 public void setPopulation(Population a_pop) { 185 m_pop = a_pop; 186 } 187 188 189 195 public Configuration getConfiguration() { 196 return m_config; 197 } 198 199 207 public void setConfiguration(Configuration a_conf) { 208 m_config = a_conf; 209 } 210 211 218 public Population getPopulation() { 219 return m_pop; 220 } 221 222 228 public Object clone() { 229 JGAPRequest result = newInstance(getSessionName(), getRID()); 230 return result; 231 } 232 233 244 public JGAPRequest newInstance(String a_name, int a_ID) { 245 JGAPRequest result = new JGAPRequest(a_name, a_ID, 246 getConfiguration(), getPopulation()); 247 result.setEvolveStrategy(getWorkerEvolveStrategy()); 248 result.setGenotypeInitializer(getGenotypeInitializer()); 249 result.setWorkerReturnStrategy(getWorkerReturnStrategy()); 250 return result; 251 } 252 } 253 | Popular Tags |