1 | package net.bmahe.genetics4j.core.spec.replacement; | |
2 | ||
3 | import org.apache.commons.lang3.Validate; | |
4 | import org.immutables.value.Value; | |
5 | ||
6 | import net.bmahe.genetics4j.core.spec.replacement.ImmutableDeleteNLast; | |
7 | import net.bmahe.genetics4j.core.spec.selection.SelectionPolicy; | |
8 | ||
9 | /** | |
10 | * Delete N Last | |
11 | * <p> | |
12 | * This replacement strategy deletes the N weakest individuals and replace them | |
13 | * with the best offsprings | |
14 | * | |
15 | */ | |
16 | @Value.Immutable | |
17 | public interface DeleteNLast extends ReplacementStrategy { | |
18 | ||
19 | static final double DEFAULT_WEAK_RATIO = 0.05; | |
20 | ||
21 | /** | |
22 | * How many weakest individuals to consider for replacement | |
23 | * | |
24 | * @return | |
25 | */ | |
26 | @Value.Default | |
27 | @Value.Parameter | |
28 | default double weakRatio() { | |
29 |
2
1. weakRatio : replaced double return with 0.0d for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::weakRatio → NO_COVERAGE 2. weakRatio : Substituted 0.05 with 1.0 → NO_COVERAGE |
return DEFAULT_WEAK_RATIO; |
30 | } | |
31 | ||
32 | /** | |
33 | * Describe which offsprings to select for the next generation | |
34 | * | |
35 | * @return | |
36 | */ | |
37 | @Value.Parameter | |
38 | public abstract SelectionPolicy offspringSelectionPolicy(); | |
39 | ||
40 | @Value.Check | |
41 | default void check() { | |
42 | Validate.inclusiveBetween(0.0, 1.0, weakRatio()); | |
43 | } | |
44 | ||
45 | class Builder extends ImmutableDeleteNLast.Builder { | |
46 | } | |
47 | ||
48 | static Builder builder() { | |
49 |
2
1. builder : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::<init> → KILLED 2. builder : replaced return value with null for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::builder → KILLED |
return new Builder(); |
50 | } | |
51 | ||
52 | static DeleteNLast of(final double weakRatio, final SelectionPolicy selectionPolicy) { | |
53 |
7
1. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::build → KILLED 2. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy → KILLED 3. of : replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio with receiver → KILLED 4. of : replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy with receiver → KILLED 5. of : replaced return value with null for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::of → KILLED 6. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio → KILLED 7. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::builder → KILLED |
return builder().weakRatio(weakRatio).offspringSelectionPolicy(selectionPolicy).build(); |
54 | } | |
55 | } | |
Mutations | ||
29 |
1.1 2.2 |
|
49 |
1.1 2.2 |
|
53 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |