Clover coverage report - JGAP 3.1
Coverage timestamp: Mo Dez 11 2006 21:16:18 CET
file stats: LOC: 69   Methods: 2
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
DefaultConfiguration.java - 0% 0% 0%
coverage
 1    /*
 2    * This file is part of JGAP.
 3    *
 4    * JGAP offers a dual license model containing the LGPL as well as the MPL.
 5    *
 6    * For licencing information please see the file license.txt included with JGAP
 7    * or have a look at the top of class org.jgap.Chromosome which representatively
 8    * includes the JGAP license policy applicable for any file delivered with JGAP.
 9    */
 10    package org.jgap.impl;
 11   
 12    import org.jgap.*;
 13    import org.jgap.event.*;
 14   
 15    /**
 16    * The DefaultConfiguration class simplifies the JGAP configuration
 17    * process by providing default configuration values for many of the
 18    * configuration settings. The following values must still be provided:
 19    * the sample Chromosome, population size, and desired fitness function.
 20    * All other settings may also be changed in the normal fashion for
 21    * those who wish to specify other custom values.
 22    *
 23    * @author Neil Rotstan
 24    * @author Klaus Meffert
 25    * @since 1.0
 26    */
 27    public class DefaultConfiguration
 28    extends Configuration {
 29    /** String containing the CVS revision. Read out via reflection!*/
 30    private final static String CVS_REVISION = "$Revision: 1.18 $";
 31   
 32  0 public DefaultConfiguration() {
 33  0 this("", "");
 34    }
 35   
 36    /**
 37    * Constructs a new DefaultConfiguration instance with a number of
 38    * configuration settings set to default values. It is still necessary
 39    * to set the sample Chromosome, population size, and desired fitness
 40    * function. Other settings may optionally be altered as desired.
 41    *
 42    * @author Neil Rotstan
 43    * @author Klaus Meffert
 44    * @since 1.0
 45    */
 46  0 public DefaultConfiguration(String a_id, String a_name) {
 47  0 super(a_id, a_name);
 48  0 try {
 49  0 setRandomGenerator(new StockRandomGenerator());
 50  0 setEventManager(new EventManager());
 51  0 BestChromosomesSelector bestChromsSelector = new BestChromosomesSelector(
 52    this, 0.95d);
 53  0 bestChromsSelector.setDoubletteChromosomesAllowed(false);
 54  0 addNaturalSelector(bestChromsSelector, true);
 55  0 setMinimumPopSizePercent(0);
 56  0 setKeepPopulationSizeConstant(true);
 57  0 setFitnessEvaluator(new DefaultFitnessEvaluator());
 58  0 setChromosomePool(new ChromosomePool());
 59  0 addGeneticOperator(new CrossoverOperator(this));
 60  0 addGeneticOperator(new MutationOperator(this, 15));
 61    }
 62    catch (InvalidConfigurationException e) {
 63  0 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    }