1 package net.bmahe.genetics4j.core.spec.mutation;
2
3 import org.apache.commons.lang3.Validate;
4 import org.immutables.value.Value;
5
6 @Value.Immutable
7 public abstract class RandomMutation implements MutationPolicy {
8
9 @Value.Parameter
10 public abstract double populationMutationProbability();
11
12 @Value.Check
13 protected void check() {
14 Validate.inclusiveBetween(0.0, 1.0, populationMutationProbability());
15 }
16
17
18
19
20
21
22
23
24
25 public static RandomMutation of(final double populationMutationProbability) {
26 return ImmutableRandomMutation.of(populationMutationProbability);
27 }
28 }