NeatChromosomeCreepMutationHandler.java

1
package net.bmahe.genetics4j.neat.mutation.chromosome;
2
3
import java.util.List;
4
import java.util.Objects;
5
import java.util.function.Supplier;
6
import java.util.random.RandomGenerator;
7
8
import net.bmahe.genetics4j.core.spec.mutation.CreepMutation;
9
import net.bmahe.genetics4j.core.spec.statistics.distributions.Distribution;
10
import net.bmahe.genetics4j.core.util.DistributionUtils;
11
import net.bmahe.genetics4j.neat.Connection;
12
import net.bmahe.genetics4j.neat.chromosomes.NeatChromosome;
13
14
public class NeatChromosomeCreepMutationHandler extends AbstractNeatChromosomeConnectionMutationHandler<CreepMutation> {
15
16
	public NeatChromosomeCreepMutationHandler(final RandomGenerator _randomGenerator) {
17
		super(CreepMutation.class, _randomGenerator);
18
	}
19
20
	@Override
21
	protected List<Connection> mutateConnection(final CreepMutation creepMutation, final NeatChromosome neatChromosome,
22
			final Connection oldConnection, final int i) {
23
		Objects.requireNonNull(creepMutation);
24
		Objects.requireNonNull(neatChromosome);
25
		Objects.requireNonNull(oldConnection);
26
27 3 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::from → KILLED
2. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection::builder → KILLED
3. mutateConnection : replaced call to net/bmahe/genetics4j/neat/Connection$Builder::from with receiver → KILLED
		final var connectionBuilder = Connection.builder().from(oldConnection);
28
29 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMinWeightValue → KILLED
		final var minValue = neatChromosome.getMinWeightValue();
30 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getMaxWeightValue → KILLED
		final var maxValue = neatChromosome.getMaxWeightValue();
31
32 1 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeCreepMutationHandler::getRandomGenerator → KILLED
		final var randomGenerator = getRandomGenerator();
33 1 1. mutateConnection : removed call to net/bmahe/genetics4j/core/spec/mutation/CreepMutation::distribution → KILLED
		final Distribution distribution = creepMutation.distribution();
34
35
		final Supplier<Float> distributionValueSupplier = DistributionUtils
36 1 1. mutateConnection : removed call to net/bmahe/genetics4j/core/util/DistributionUtils::distributionFloatValueSupplier → KILLED
				.distributionFloatValueSupplier(randomGenerator, minValue, maxValue, distribution);
37
38 3 1. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection::weight → KILLED
2. mutateConnection : removed call to net/bmahe/genetics4j/neat/chromosomes/NeatChromosome::getConnections → KILLED
3. mutateConnection : removed call to java/util/List::get → KILLED
		float newWeight = neatChromosome.getConnections().get(i).weight();
39 3 1. mutateConnection : Replaced float addition with subtraction → KILLED
2. mutateConnection : removed call to java/lang/Float::floatValue → KILLED
3. mutateConnection : removed call to java/util/function/Supplier::get → KILLED
		newWeight += distributionValueSupplier.get();
40 4 1. mutateConnection : changed conditional boundary → SURVIVED
2. mutateConnection : negated conditional → KILLED
3. mutateConnection : removed conditional - replaced comparison check with false → KILLED
4. mutateConnection : removed conditional - replaced comparison check with true → KILLED
		if (newWeight > maxValue) {
41
			newWeight = maxValue;
42 4 1. mutateConnection : changed conditional boundary → SURVIVED
2. mutateConnection : removed conditional - replaced comparison check with false → KILLED
3. mutateConnection : negated conditional → KILLED
4. mutateConnection : removed conditional - replaced comparison check with true → KILLED
		} else if (newWeight < minValue) {
43
			newWeight = minValue;
44
		}
45 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);
46
47 3 1. mutateConnection : replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeCreepMutationHandler::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());
48
	}
49
}

Mutations

27

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

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

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

29

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

30

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

32

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

33

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/core/spec/mutation/CreepMutation::distribution → KILLED

36

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/core/util/DistributionUtils::distributionFloatValueSupplier → KILLED

38

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

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

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

39

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

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed call to java/lang/Float::floatValue → KILLED

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

40

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
negated conditional → KILLED

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed conditional - replaced comparison check with false → KILLED

3.3
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed conditional - replaced comparison check with true → KILLED

4.4
Location : mutateConnection
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

42

1.1
Location : mutateConnection
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed conditional - replaced comparison check with false → KILLED

3.3
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
negated conditional → KILLED

4.4
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed conditional - replaced comparison check with true → KILLED

45

1.1
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[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.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed call to net/bmahe/genetics4j/neat/Connection$Builder::weight → KILLED

47

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

2.2
Location : mutateConnection
Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[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.NeatChromosomeCreepMutationHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeCreepMutationHandlerTest]/[method:mutateConnection()]
removed call to java/util/List::of → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.3