FloatChromosomeSinglePointArithmetic.java

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

Mutations

22

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

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 alpha → KILLED

35

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

40

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

44

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

46

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

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

49

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

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()]
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

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()]
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

53

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

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()]
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

58

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

60

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

61

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

64

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

65

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.19.6