FloatChromosomeSinglePointArithmetic.java

1
package net.bmahe.genetics4j.core.combination.singlepointarithmetic;
2
3
import java.util.List;
4
import java.util.Objects;
5
import java.util.random.RandomGenerator;
6
7
import org.apache.commons.lang3.Validate;
8
9
import net.bmahe.genetics4j.core.chromosomes.Chromosome;
10
import net.bmahe.genetics4j.core.chromosomes.FloatChromosome;
11
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator;
12
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
13
14
public class FloatChromosomeSinglePointArithmetic<T extends Comparable<T>> implements ChromosomeCombinator<T> {
15
16
	private final RandomGenerator randomGenerator;
17
	private final float alpha;
18
19
	public FloatChromosomeSinglePointArithmetic(final RandomGenerator _randomGenerator, final float _alpha) {
20
		Objects.requireNonNull(_randomGenerator);
21
		Validate.inclusiveBetween(0.0d, 1.0d, _alpha);
22
23 1 1. <init> : Removed assignment to member variable randomGenerator → KILLED
		this.randomGenerator = _randomGenerator;
24 1 1. <init> : Removed assignment to member variable alpha → KILLED
		this.alpha = _alpha;
25
	}
26
27
	@Override
28
	public List<Chromosome> combine(final AbstractEAConfiguration<T> eaConfiguration, final Chromosome chromosome1,
29
			final T firstParentFitness, final Chromosome chromosome2, final T secondParentFitness) {
30
		Objects.requireNonNull(chromosome1);
31
		Objects.requireNonNull(chromosome2);
32
		Validate.isInstanceOf(FloatChromosome.class, chromosome1);
33
		Validate.isInstanceOf(FloatChromosome.class, chromosome2);
34
		Validate.isTrue(chromosome1.getNumAlleles() == chromosome2.getNumAlleles());
35
36 3 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → SURVIVED
2. combine : removed call to java/util/random/RandomGenerator::nextInt → KILLED
3. combine : replaced call to java/util/random/RandomGenerator::nextInt with argument → KILLED
		final int alleleSplit = randomGenerator.nextInt(chromosome1.getNumAlleles());
37
38
		final FloatChromosome intChromosome1 = (FloatChromosome) chromosome1;
39
		final FloatChromosome intChromosome2 = (FloatChromosome) chromosome2;
40
41 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → KILLED
		final int numAlleles = chromosome1.getNumAlleles();
42
		final float[] firstChildValues = new float[numAlleles];
43
		final float[] secondChildValues = new float[numAlleles];
44
45 5 1. combine : removed conditional - replaced comparison check with false → KILLED
2. combine : negated conditional → KILLED
3. combine : Substituted 0 with 1 → KILLED
4. combine : changed conditional boundary → KILLED
5. combine : removed conditional - replaced comparison check with true → KILLED
		for (int i = 0; i < numAlleles; i++) {
46
47 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getAllele → KILLED
			final float firstAllele = intChromosome1.getAllele(i);
48 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getAllele → KILLED
			final float secondAllele = intChromosome2.getAllele(i);
49
50 4 1. combine : negated conditional → KILLED
2. combine : changed conditional boundary → KILLED
3. combine : removed conditional - replaced comparison check with false → KILLED
4. combine : removed conditional - replaced comparison check with true → KILLED
			if (i < alleleSplit) {
51 5 1. combine : Replaced float addition with subtraction → KILLED
2. combine : Substituted 1.0 with 2.0 → KILLED
3. combine : Replaced float multiplication with division → KILLED
4. combine : Replaced float subtraction with addition → KILLED
5. combine : Replaced float multiplication with division → KILLED
				firstChildValues[i] = alpha * firstAllele + (1 - alpha) * secondAllele;
52 5 1. combine : Substituted 1.0 with 2.0 → KILLED
2. combine : Replaced float addition with subtraction → KILLED
3. combine : Replaced float subtraction with addition → KILLED
4. combine : Replaced float multiplication with division → KILLED
5. combine : Replaced float multiplication with division → KILLED
				secondChildValues[i] = (1 - alpha) * firstAllele + alpha * secondAllele;
53
			} else {
54 5 1. combine : Substituted 1.0 with 2.0 → KILLED
2. combine : Replaced float subtraction with addition → KILLED
3. combine : Replaced float multiplication with division → KILLED
4. combine : Replaced float multiplication with division → KILLED
5. combine : Replaced float addition with subtraction → KILLED
				firstChildValues[i] = (1 - alpha) * firstAllele + alpha * secondAllele;
55 5 1. combine : Replaced float multiplication with division → KILLED
2. combine : Replaced float subtraction with addition → KILLED
3. combine : Replaced float multiplication with division → KILLED
4. combine : Substituted 1.0 with 2.0 → KILLED
5. combine : Replaced float addition with subtraction → KILLED
				secondChildValues[i] = alpha * firstAllele + (1 - alpha) * secondAllele;
56
			}
57
		}
58
59 2 1. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/singlepointarithmetic/FloatChromosomeSinglePointArithmetic::combine → KILLED
2. combine : removed call to java/util/List::of → KILLED
		return List.of(
60
				new FloatChromosome(numAlleles,
61 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMinValue → SURVIVED
						intChromosome1.getMinValue(),
62 2 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMaxValue → SURVIVED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::<init> → KILLED
						intChromosome1.getMaxValue(),
63
						firstChildValues),
64
					new FloatChromosome(numAlleles,
65 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMinValue → SURVIVED
							intChromosome1.getMinValue(),
66 2 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMaxValue → SURVIVED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::<init> → KILLED
							intChromosome1.getMaxValue(),
67
							secondChildValues));
68
	}
69
}

Mutations

23

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Removed assignment to member variable randomGenerator → KILLED

24

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Removed assignment to member variable alpha → KILLED

36

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to java/util/random/RandomGenerator::nextInt → KILLED

2.2
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → SURVIVED
Covering tests

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
replaced call to java/util/random/RandomGenerator::nextInt with argument → KILLED

41

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → KILLED

45

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed conditional - replaced comparison check with false → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
negated conditional → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Substituted 0 with 1 → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
changed conditional boundary → KILLED

5.5
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed conditional - replaced comparison check with true → KILLED

47

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getAllele → KILLED

48

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getAllele → KILLED

50

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
negated conditional → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
changed conditional boundary → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed conditional - replaced comparison check with false → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed conditional - replaced comparison check with true → KILLED

51

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float addition with subtraction → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Substituted 1.0 with 2.0 → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float subtraction with addition → KILLED

5.5
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

52

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Substituted 1.0 with 2.0 → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float addition with subtraction → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float subtraction with addition → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

5.5
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

54

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Substituted 1.0 with 2.0 → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float subtraction with addition → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

5.5
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float addition with subtraction → KILLED

55

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float subtraction with addition → KILLED

3.3
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float multiplication with division → KILLED

4.4
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Substituted 1.0 with 2.0 → KILLED

5.5
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
Replaced float addition with subtraction → KILLED

59

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/singlepointarithmetic/FloatChromosomeSinglePointArithmetic::combine → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to java/util/List::of → KILLED

61

1.1
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMinValue → SURVIVED
Covering tests

62

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::<init> → KILLED

2.2
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMaxValue → SURVIVED
Covering tests

65

1.1
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMinValue → SURVIVED
Covering tests

66

1.1
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::getMaxValue → SURVIVED
Covering tests

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.FloatChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed call to net/bmahe/genetics4j/core/chromosomes/FloatChromosome::<init> → KILLED

Active mutators

Tests examined


Report generated by PIT 1.25.7 support