|
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>This replacement strategy deletes the N weakest individuals and replace them with the best offsprings |
|
12
|
|
* |
|
13
|
|
*/ |
|
14
|
|
@Value.Immutable |
|
15
|
|
public interface DeleteNLast extends ReplacementStrategy { |
|
16
|
|
|
|
17
|
|
static final double DEFAULT_WEAK_RATIO = 0.05; |
|
18
|
|
|
|
19
|
|
/** |
|
20
|
|
* How many weakest individuals to consider for replacement |
|
21
|
|
* |
|
22
|
|
* @return |
|
23
|
|
*/ |
|
24
|
|
@Value.Default |
|
25
|
|
@Value.Parameter |
|
26
|
|
default double weakRatio() { |
|
27
|
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; |
|
28
|
|
} |
|
29
|
|
|
|
30
|
|
/** |
|
31
|
|
* Describe which offsprings to select for the next generation |
|
32
|
|
* |
|
33
|
|
* @return |
|
34
|
|
*/ |
|
35
|
|
@Value.Parameter |
|
36
|
|
public abstract SelectionPolicy offspringSelectionPolicy(); |
|
37
|
|
|
|
38
|
|
@Value.Check |
|
39
|
|
default void check() { |
|
40
|
|
Validate.inclusiveBetween(0.0, 1.0, weakRatio()); |
|
41
|
|
} |
|
42
|
|
|
|
43
|
|
class Builder extends ImmutableDeleteNLast.Builder { |
|
44
|
|
} |
|
45
|
|
|
|
46
|
|
static Builder builder() { |
|
47
|
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(); |
|
48
|
|
} |
|
49
|
|
|
|
50
|
|
static DeleteNLast of(final double weakRatio, final SelectionPolicy selectionPolicy) { |
|
51
|
4
1. of : replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio with receiver → KILLED
2. of : replaced return value with null for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::of → KILLED
3. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio → KILLED
4. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::builder → KILLED
|
return builder().weakRatio(weakRatio) |
|
52
|
2
1. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy → KILLED
2. of : replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy with receiver → KILLED
|
.offspringSelectionPolicy(selectionPolicy) |
|
53
|
1
1. of : removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::build → KILLED
|
.build(); |
|
54
|
|
} |
|
55
|
|
} |
| | Mutations |
| 27 |
|
1.1 Location : weakRatio Killed by : none replaced double return with 0.0d for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::weakRatio → NO_COVERAGE
2.2 Location : weakRatio Killed by : none Substituted 0.05 with 1.0 → NO_COVERAGE
|
| 47 |
|
1.1 Location : builder Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::<init> → KILLED
2.2 Location : builder Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] replaced return value with null for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::builder → KILLED
|
| 51 |
|
1.1 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:select()] replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio with receiver → KILLED
2.2 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:select()] replaced return value with null for net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::of → KILLED
3.3 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::weakRatio → KILLED
4.4 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast::builder → KILLED
|
| 52 |
|
1.1 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy → KILLED
2.2 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:ctorNullSelector()] replaced call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::offspringSelectionPolicy with receiver → KILLED
|
| 53 |
|
1.1 Location : of Killed by : net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.DeleteNLastImplTest]/[method:select()] removed call to net/bmahe/genetics4j/core/spec/replacement/DeleteNLast$Builder::build → KILLED
|