blob: 4070468b2021ca3bc1ab64a3df2aa86c46e979b7 (
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 tournament;
public TournamentSelection() {
tournament = new IntegerParameter(1, "Tournament size") {
@Override
public void validate(Number newValue) {
// TODO this
}
};
}
@Override
public Parameter<?>[] getLocalParameters() {
return new Parameter[] {tournament};
}
@Override
public void evolve(Population population, Mutator mutator,
Resources parameters) {
tournament.set(tournament.get() + 1);
// TODO implement this
}
@Override
public String toString() {
return "Tournament";
}
}
|