NeatChromosomeRandomMutationHandler.java

1
package net.bmahe.genetics4j.neat.mutation.chromosome;
2
3
import java.util.List;
4
import java.util.Objects;
5
import java.util.random.RandomGenerator;
6
7
import net.bmahe.genetics4j.core.spec.mutation.RandomMutation;
8
import net.bmahe.genetics4j.neat.Connection;
9
import net.bmahe.genetics4j.neat.chromosomes.NeatChromosome;
10
11
public class NeatChromosomeRandomMutationHandler
12
		extends AbstractNeatChromosomeConnectionMutationHandler<RandomMutation>
13
{
14
15
	public NeatChromosomeRandomMutationHandler(final RandomGenerator _randomGenerator) {
16
		super(RandomMutation.class, _randomGenerator);
17
	}
18
19
	@Override
20
	protected List<Connection> mutateConnection(final RandomMutation randomMutation, final NeatChromosome neatChromosome,
21
			final Connection oldConnection, final int i) {
22
		Objects.requireNonNull(randomMutation);
23
		Objects.requireNonNull(neatChromosome);
24
		Objects.requireNonNull(oldConnection);
25
26 3 1. mutateConnection : replaced call to net/bmahe/genetics4j/neat/Connection$Builder::from with receiver → KILLED
2. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection::builder → KILLED
3. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::from → KILLED
		final var connectionBuilder = Connection.builder().from(oldConnection);
27
28 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMinWeightValue → KILLED
		final var minValue = neatChromosome.getMinWeightValue();
29 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMaxWeightValue → SURVIVED
		final var maxValue = neatChromosome.getMaxWeightValue();
30
31 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeRandomMutationHandler::getRandomGenerator → KILLED
		final var randomGenerator = getRandomGenerator();
32
33
		// TODO use distribution
34 4 1. mutateConnection : Replaced float subtraction with addition → SURVIVED
2. mutateConnection : removed call to java/util/random/RandomGenerator::nextFloat → KILLED
3. mutateConnection : Replaced float addition with subtraction → KILLED
4. mutateConnection : replaced call to java/util/random/RandomGenerator::nextFloat with argument → KILLED
		float newWeight = randomGenerator.nextFloat(maxValue - minValue) + minValue;
35 2 1. mutateConnection : replaced call to net/bmahe/genetics4j/neat/Connection$Builder::weight with receiver → KILLED
2. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::weight → KILLED
		connectionBuilder.weight(newWeight);
36 3 1. mutateConnection : replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeRandomMutationHandler::mutateConnection → KILLED
2. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::build → KILLED
3. mutateConnection : removed call to java/util/List::of → KILLED
		return List.of(connectionBuilder.build());
37
	}
38
}

Mutations

26

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
replaced call to net/bmahe/genetics4j/neat/Connection$Builder::from with receiver → KILLED

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/Connection::builder → KILLED

3.3
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/Connection$Builder::from → KILLED

28

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMinWeightValue → KILLED

29

1.1
Location : mutateConnection
Killed by : none
removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMaxWeightValue → SURVIVED
Covering tests

31

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeRandomMutationHandler::getRandomGenerator → KILLED

34

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to java/util/random/RandomGenerator::nextFloat → KILLED

2.2
Location : mutateConnection
Killed by : none
Replaced float subtraction with addition → SURVIVED
Covering tests

3.3
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
Replaced float addition with subtraction → KILLED

4.4
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
replaced call to java/util/random/RandomGenerator::nextFloat with argument → KILLED

35

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
replaced call to net/bmahe/genetics4j/neat/Connection$Builder::weight with receiver → KILLED

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/Connection$Builder::weight → KILLED

36

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeRandomMutationHandler::mutateConnection → KILLED

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/Connection$Builder::build → KILLED

3.3
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeRandomMutationHandlerTest]/[method:mutateConnection()]
removed call to java/util/List::of → KILLED

Active mutators

Tests examined


Report generated by PIT 1.23.1 support