package jcgp.backend.modules.ea; import java.util.HashMap; import jcgp.backend.modules.mutator.Mutator; import jcgp.backend.population.Population; import jcgp.backend.resources.Resources; import jcgp.backend.resources.parameters.IntegerParameter; import jcgp.backend.resources.parameters.Parameter; public class TournamentSelection implements EvolutionaryAlgorithm { private int fittestChromosome; private IntegerParameter tournament; private HashMap localParameters; public TournamentSelection() { tournament = new IntegerParameter(1, "Tournament size") { @Override public void validate(int newValue) { // TODO this } }; 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"; } }