| 1 | package net.bmahe.genetics4j.core.spec.mutation; | |
| 2 | ||
| 3 | import org.apache.commons.lang3.Validate; | |
| 4 | import org.immutables.value.Value; | |
| 5 | ||
| 6 | import net.bmahe.genetics4j.core.spec.statistics.distributions.Distribution; | |
| 7 | import net.bmahe.genetics4j.core.spec.statistics.distributions.NormalDistribution; | |
| 8 | ||
| 9 | @Value.Immutable | |
| 10 | public abstract class CreepMutation implements MutationPolicy { | |
| 11 | ||
| 12 | @Value.Parameter | |
| 13 | public abstract double populationMutationProbability(); | |
| 14 | ||
| 15 | @Value.Parameter | |
| 16 | public abstract Distribution distribution(); | |
| 17 | ||
| 18 | @Value.Check | |
| 19 | protected void check() { | |
| 20 | Validate.inclusiveBetween(0.0, 1.0, populationMutationProbability()); | |
| 21 | } | |
| 22 | ||
| 23 | public static CreepMutation of(final double populationMutationProbability, final Distribution distribution) { | |
| 24 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/mutation/CreepMutation::of → KILLED 2. of : removed call to net/bmahe/genetics4j/core/spec/mutation/ImmutableCreepMutation::of → KILLED |
return ImmutableCreepMutation.of(populationMutationProbability, distribution); |
| 25 | } | |
| 26 | ||
| 27 | public static CreepMutation ofNormal(final double populationMutationProbability, final double mean, | |
| 28 | final double standardDeviation) { | |
| 29 |
3
1. ofNormal : replaced return value with null for net/bmahe/genetics4j/core/spec/mutation/CreepMutation::ofNormal → KILLED 2. ofNormal : removed call to net/bmahe/genetics4j/core/spec/statistics/distributions/NormalDistribution::of → KILLED 3. ofNormal : removed call to net/bmahe/genetics4j/core/spec/mutation/ImmutableCreepMutation::of → KILLED |
return ImmutableCreepMutation.of(populationMutationProbability, NormalDistribution.of(mean, standardDeviation)); |
| 30 | } | |
| 31 | } | |
Mutations | ||
| 24 |
1.1 2.2 |
|
| 29 |
1.1 2.2 3.3 |