1 10 package org.jgap.distr; 11 12 import org.jgap.*; 13 14 20 public class Problem { 21 22 private final static String CVS_REVISION = "$Revision: 1.2 $"; 23 24 private FitnessFunction m_fitFunc; 25 26 private int m_populationSize; 27 28 private Object m_ID; 29 30 private Chromosome[] m_initialChroms; 31 32 public Problem() { 33 } 34 35 45 public Problem(FitnessFunction a_fitFunc, int a_popSize, 46 Chromosome[] a_initialChroms) throws IllegalArgumentException { 47 if (a_fitFunc == null) { 48 throw new IllegalArgumentException ("Fitness function must not be null!"); 49 } 50 if (a_popSize <= 0) { 51 throw new IllegalArgumentException ("Population size must be greater zero."); 52 } 53 m_fitFunc = a_fitFunc; 54 m_populationSize = a_popSize; 55 m_initialChroms = a_initialChroms; 56 } 57 58 64 public void setID(Object a_ID) { 65 m_ID = a_ID; 66 } 67 68 74 public Object getID() { 75 return m_ID; 76 } 77 78 84 public int getPopulationSize() { 85 return m_populationSize; 86 } 87 88 94 public FitnessFunction getFitnessFunction() { 95 return m_fitFunc; 96 } 97 98 104 public Chromosome[] getChromosomes() { 105 return m_initialChroms; 106 } 107 } 108 | Popular Tags |