package jcgp.backend.modules.ea; import java.util.HashMap; import jcgp.JCGP.Resources; import jcgp.backend.modules.ModuleStatus; import jcgp.backend.modules.mutator.Mutator; import jcgp.backend.parameters.IntegerParameter; import jcgp.backend.parameters.Parameter; import jcgp.backend.population.Population; public class TournamentSelection implements EvolutionaryAlgorithm { private int fittestChromosome; private IntegerParameter tournament; private HashMap localParameters; public TournamentSelection() { tournament = new IntegerParameter(1, "Tournament size") { @Override protected void validate(int newValue) { } }; localParameters = new HashMap(); localParameters.put("tournament", tournament); } @Override public Parameter[] getLocalParameters() { return new Parameter[] {tournament}; } @Override public void evolve(Population population, Mutator mutator, Resources parameters) { tournament.set(tournament.get() + 1); fittestChromosome = 0; // TODO implement this } @Override public int getFittestChromosome() { return fittestChromosome; } @Override public String toString() { return "Tournament"; } @Override public ModuleStatus getStatus(Resources resources) { return null; } }