package nl.ru.ai.projects.parrot.ea.evolve;
import java.util.ArrayList;
import nl.ru.ai.projects.parrot.tools.TerminalCondition;
import org.jgap.Configuration;
import org.jgap.DefaultFitnessEvaluator;
import org.jgap.InvalidConfigurationException;
import org.jgap.event.EventManager;
import org.jgap.impl.BestChromosomesSelector;
import org.jgap.impl.ChromosomePool;
import org.jgap.impl.GABreeder;
import org.jgap.impl.StockRandomGenerator;
import org.jgap.util.ICloneable;
private static final long serialVersionUID = 1L;
private ArrayList<TerminalCondition> stopConditions;
public final int MAX_EVOLUTIONS = 30;
public final int POPULATION_SIZE = 25;
public final boolean ELITISM = true;
public final int FSM_TIMER_THRESHOLD = 300000;
public final boolean OUTPUT_FITNESS_HISTORY = true;
public final boolean OUTPUT_FITNESS_END = true;
public final int OUTPUT_TIMINGS_ATITERATION = 10;
super();
try {
setBreeder(new GABreeder());
setRandomGenerator(new StockRandomGenerator());
setEventManager(new EventManager());
BestChromosomesSelector bestChromsSelector = new BestChromosomesSelector(this, 0.70d);
bestChromsSelector.setDoubletteChromosomesAllowed(false);
addNaturalSelector(bestChromsSelector, false);
setMinimumPopSizePercent(80);
setSelectFromPrevGen(0.8d);
setKeepPopulationSizeConstant(true);
setFitnessEvaluator(new DefaultFitnessEvaluator());
setAlwaysCaculateFitness(false);
setChromosomePool(new ChromosomePool());
setPreservFittestIndividual(ELITISM);
stopConditions = new ArrayList<TerminalCondition>();
} catch ( InvalidConfigurationException e ) {
throw new RuntimeException("Fatal error: could not load configuration for the evoluationary algorithm");
}
}
return stopConditions;
}
stopConditions.add(condition);
}
}