1 10 package org.jgap; 11 12 import org.jgap.util.*; 13 14 21 public class DefaultFitnessEvaluator 22 implements FitnessEvaluator, ICloneable, Comparable { 23 24 private final static String CVS_REVISION = "$Revision: 1.12 $"; 25 26 36 public boolean isFitter(final double a_fitness_value1, 37 final double a_fitness_value2) { 38 return a_fitness_value1 > a_fitness_value2; 39 } 40 41 public boolean isFitter(IChromosome a_chrom1, IChromosome a_chrom2) { 42 return isFitter(a_chrom1.getFitnessValue(), a_chrom2.getFitnessValue()); 43 } 44 45 51 public Object clone() { 52 return new DefaultFitnessEvaluator(); 53 } 54 55 62 public int compareTo(Object a_other) { 63 if (a_other.getClass().equals(getClass())) { 64 return 0; 65 } 66 else { 67 return getClass().getName().compareTo(a_other.getClass().getName()); 68 } 69 } 70 } 71 | Popular Tags |