aboutsummaryrefslogtreecommitdiffstats
path: root/src/jcgp/backend/modules/es/TournamentSelection.java
blob: 7cc9706078ca07dc996842d0b87605e15f1a76f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package jcgp.backend.modules.es;

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 EvolutionaryStrategy {
	
	private IntegerParameter tournamentSize;
	
	public TournamentSelection(Resources resources) {		
		tournamentSize = new IntegerParameter(1, "Tournament size") {
			@Override
			public void validate(Number newValue) {
				// TODO this
			}
		};
	}

	@Override
	public Parameter<?>[] getLocalParameters() {
		return new Parameter[] {tournamentSize};
	}

	@Override
	public void evolve(Population population, Mutator mutator,
			Resources parameters) {
		tournamentSize.set(tournamentSize.get() + 1);
		// TODO implement this

	}
	
	@Override
	public String toString() {
		return "Tournament";
	}
}