1 | package net.bmahe.genetics4j.core.spec.selection; | |
2 | ||
3 | import java.util.Comparator; | |
4 | ||
5 | import org.apache.commons.lang3.Validate; | |
6 | import org.immutables.value.Value; | |
7 | ||
8 | import net.bmahe.genetics4j.core.Individual; | |
9 | ||
10 | @Value.Immutable | |
11 | public abstract class DoubleTournament<T extends Comparable<T>> implements SelectionPolicy { | |
12 | ||
13 | @Value.Parameter | |
14 | public abstract Tournament<T> fitnessTournament(); | |
15 | ||
16 | @Value.Parameter | |
17 | public abstract Comparator<Individual<T>> parsimonyComparator(); | |
18 | ||
19 | @Value.Parameter | |
20 | public abstract double parsimonyTournamentSize(); | |
21 | ||
22 | @Value.Default | |
23 | public boolean doFitnessFirst() { | |
24 |
2
1. doFitnessFirst : Substituted 1 with 0 → KILLED 2. doFitnessFirst : replaced boolean return with false for net/bmahe/genetics4j/core/spec/selection/DoubleTournament::doFitnessFirst → KILLED |
return true; |
25 | } | |
26 | ||
27 | @Value.Check | |
28 | public void check() { | |
29 | Validate.inclusiveBetween(0.0d, 2.0d, parsimonyTournamentSize()); | |
30 | } | |
31 | ||
32 | public static <U extends Comparable<U>> DoubleTournament<U> of(final Tournament<U> fitnessTournament, | |
33 | final Comparator<Individual<U>> parsimonyComparator, final double parsimonyTournamentSize) { | |
34 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/DoubleTournament::of → KILLED 2. of : removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableDoubleTournament::of → KILLED |
return ImmutableDoubleTournament.of(fitnessTournament, parsimonyComparator, parsimonyTournamentSize); |
35 | } | |
36 | } | |
Mutations | ||
24 |
1.1 2.2 |
|
34 |
1.1 2.2 |