| 1 | package net.bmahe.genetics4j.neat.spec.mutation; | |
| 2 | ||
| 3 | import org.apache.commons.lang3.Validate; | |
| 4 | import org.immutables.value.Value; | |
| 5 | ||
| 6 | import net.bmahe.genetics4j.core.spec.mutation.MutationPolicy; | |
| 7 | ||
| 8 | @Value.Immutable | |
| 9 | public abstract class AddConnection implements MutationPolicy { | |
| 10 | ||
| 11 | @Value.Parameter | |
| 12 | public abstract double populationMutationProbability(); | |
| 13 | ||
| 14 | /** | |
| 15 | * Indicates whether output nodes may be selected as the source of new connections. | |
| 16 | * | |
| 17 | * <p>Enabling this option allows recurrent topologies such as output-to-hidden and output-to-output connections. | |
| 18 | * Such topologies are intended for evaluation with a recurrent network.</p> | |
| 19 | * | |
| 20 | * @return {@code true} when output nodes may be connection sources | |
| 21 | */ | |
| 22 | @Value.Default | |
| 23 | public boolean allowOutputNodeAsSource() { | |
| 24 |
2
1. allowOutputNodeAsSource : Substituted 0 with 1 → KILLED 2. allowOutputNodeAsSource : replaced boolean return with true for net/bmahe/genetics4j/neat/spec/mutation/AddConnection::allowOutputNodeAsSource → KILLED |
return false; |
| 25 | } | |
| 26 | ||
| 27 | @Value.Check | |
| 28 | protected void check() { | |
| 29 | Validate.inclusiveBetween(0.0, 1.0, populationMutationProbability()); | |
| 30 | } | |
| 31 | ||
| 32 | public static class Builder extends ImmutableAddConnection.Builder { | |
| 33 | } | |
| 34 | ||
| 35 | public static Builder builder() { | |
| 36 |
2
1. builder : removed call to net/bmahe/genetics4j/neat/spec/mutation/AddConnection$Builder::<init> → KILLED 2. builder : replaced return value with null for net/bmahe/genetics4j/neat/spec/mutation/AddConnection::builder → KILLED |
return new Builder(); |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * Construct a new immutable {@code AddConnection} instance using feed-forward-compatible defaults. | |
| 41 | * | |
| 42 | * @param populationMutationProbability The value for the {@code populationMutationProbability} attribute | |
| 43 | * @return An immutable AddConnection instance | |
| 44 | */ | |
| 45 | public static AddConnection of(final double populationMutationProbability) { | |
| 46 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/neat/spec/mutation/AddConnection::of → KILLED 2. of : removed call to net/bmahe/genetics4j/neat/spec/mutation/ImmutableAddConnection::of → KILLED |
return ImmutableAddConnection.of(populationMutationProbability); |
| 47 | } | |
| 48 | ||
| 49 | } | |
Mutations | ||
| 24 |
1.1 2.2 |
|
| 36 |
1.1 2.2 |
|
| 46 |
1.1 2.2 |