1 10 package org.jgap.impl; 11 12 import org.jgap.*; 13 import org.jgap.event.*; 14 import org.jgap.util.*; 15 16 28 public class DefaultConfiguration 29 extends Configuration implements ICloneable { 30 31 private final static String CVS_REVISION = "$Revision: 1.19 $"; 32 33 public DefaultConfiguration() { 34 this("",""); 35 } 36 46 public DefaultConfiguration(String a_id, String a_name) { 47 super(a_id, a_name); 48 try { 49 setRandomGenerator(new StockRandomGenerator()); 50 setEventManager(new EventManager()); 51 BestChromosomesSelector bestChromsSelector = new BestChromosomesSelector( 52 this, 0.95d); 53 bestChromsSelector.setDoubletteChromosomesAllowed(false); 54 addNaturalSelector(bestChromsSelector, true); 55 setMinimumPopSizePercent(0); 56 setKeepPopulationSizeConstant(true); 57 setFitnessEvaluator(new DefaultFitnessEvaluator()); 58 setChromosomePool(new ChromosomePool()); 59 addGeneticOperator(new CrossoverOperator(this)); 60 addGeneticOperator(new MutationOperator(this, 15)); 61 } 62 catch (InvalidConfigurationException e) { 63 throw new RuntimeException ( 64 "Fatal error: DefaultConfiguration class could not use its " 65 + "own stock configuration values. This should never happen. " 66 + "Please report this as a bug to the JGAP team."); 67 } 68 } 69 70 76 public Object clone() { 77 return super.clone(); 78 } 79 } 80 | Popular Tags |