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.Chromosome; import jcgp.backend.population.Population; public class TournamentSelection implements EvolutionaryAlgorithm { private Chromosome fittestChromosome; private IntegerParameter tournament; private HashMap localParameters; public TournamentSelection() { tournament = new IntegerParameter(1, "Tournament size"); localParameters = new HashMap(); localParameters.put("tournament", tournament); } @Override public HashMap getLocalParameters() { return localParameters; } @Override public void evolve(Population population, Mutator mutator, Resources parameters) { tournament.set(tournament.get() + 1); fittestChromosome = population.getChromosome(0); // TODO implement this } @Override public Chromosome getFittestChromosome() { return fittestChromosome; } @Override public String toString() { return "Tournament"; } @Override public ModuleStatus getStatus(Resources resources) { return null; } }