IntChromosomeSinglePointArithmetic.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.IntChromosome;
11
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator;
12
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
13
14
public class IntChromosomeSinglePointArithmetic<T extends Comparable<T>> implements ChromosomeCombinator<T> {
15
16
	private final RandomGenerator randomGenerator;
17
	private final double alpha;
18
19
	public IntChromosomeSinglePointArithmetic(final RandomGenerator _randomGenerator, final double _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(IntChromosome.class, chromosome1);
33
		Validate.isInstanceOf(IntChromosome.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 : replaced call to java/util/random/RandomGenerator::nextInt with argument → KILLED
3. combine : removed call to java/util/random/RandomGenerator::nextInt → KILLED
		final int alleleSplit = randomGenerator.nextInt(chromosome1.getNumAlleles());
37
38
		final IntChromosome intChromosome1 = (IntChromosome) chromosome1;
39
		final IntChromosome intChromosome2 = (IntChromosome) chromosome2;
40
41 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → KILLED
		final int numAlleles = chromosome1.getNumAlleles();
42
		final int[] firstChildValues = new int[numAlleles];
43
		final int[] secondChildValues = new int[numAlleles];
44
45 5 1. combine : removed conditional - replaced comparison check with true → KILLED
2. combine : negated conditional → KILLED
3. combine : removed conditional - replaced comparison check with false → KILLED
4. combine : Substituted 0 with 1 → KILLED
5. combine : changed conditional boundary → KILLED
		for (int i = 0; i < numAlleles; i++) {
46
47 2 1. combine : replaced call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele with argument → SURVIVED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele → KILLED
			final int firstAllele = intChromosome1.getAllele(i);
48 2 1. combine : replaced call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele with argument → KILLED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele → KILLED
			final int secondAllele = intChromosome2.getAllele(i);
49
50 4 1. combine : changed conditional boundary → SURVIVED
2. combine : negated conditional → KILLED
3. combine : removed conditional - replaced comparison check with true → KILLED
4. combine : removed conditional - replaced comparison check with false → KILLED
			if (i < alleleSplit) {
51 5 1. combine : Replaced double multiplication with division → KILLED
2. combine : Replaced double subtraction with addition → KILLED
3. combine : Replaced double multiplication with division → KILLED
4. combine : Substituted 1.0 with 2.0 → KILLED
5. combine : Replaced double addition with subtraction → KILLED
				firstChildValues[i] = (int) (alpha * firstAllele + (1 - alpha) * secondAllele);
52 5 1. combine : Replaced double subtraction with addition → SURVIVED
2. combine : Replaced double addition with subtraction → KILLED
3. combine : Replaced double multiplication with division → KILLED
4. combine : Substituted 1.0 with 2.0 → KILLED
5. combine : Replaced double multiplication with division → KILLED
				secondChildValues[i] = (int) ((1 - alpha) * firstAllele + alpha * secondAllele);
53
			} else {
54 5 1. combine : Replaced double addition with subtraction → SURVIVED
2. combine : Replaced double multiplication with division → KILLED
3. combine : Substituted 1.0 with 2.0 → KILLED
4. combine : Replaced double multiplication with division → KILLED
5. combine : Replaced double subtraction with addition → KILLED
				firstChildValues[i] = (int) ((1 - alpha) * firstAllele + alpha * secondAllele);
55 5 1. combine : Replaced double subtraction with addition → SURVIVED
2. combine : Replaced double multiplication with division → KILLED
3. combine : Substituted 1.0 with 2.0 → KILLED
4. combine : Replaced double addition with subtraction → KILLED
5. combine : Replaced double multiplication with division → KILLED
				secondChildValues[i] = (int) (alpha * firstAllele + (1 - alpha) * secondAllele);
56
			}
57
		}
58
59 2 1. combine : removed call to java/util/List::of → KILLED
2. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/singlepointarithmetic/IntChromosomeSinglePointArithmetic::combine → KILLED
		return List.of(
60 3 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getMinValue → SURVIVED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getMaxValue → SURVIVED
3. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::<init> → KILLED
				new IntChromosome(numAlleles, intChromosome1.getMinValue(), intChromosome1.getMaxValue(), firstChildValues),
61
					new IntChromosome(numAlleles,
62 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getMinValue → SURVIVED
							intChromosome1.getMinValue(),
63 2 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getMaxValue → SURVIVED
2. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::<init> → KILLED
							intChromosome1.getMaxValue(),
64
							secondChildValues));
65
	}
66
}

Mutations

23

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

24

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

36

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

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

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

41

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.IntChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.IntChromosomeSinglePointArithmeticTest]/[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.IntChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.IntChromosomeSinglePointArithmeticTest]/[method:combineTest()]
removed conditional - replaced comparison check with true → KILLED

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

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

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

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

47

1.1
Location : combine
Killed by : none
replaced call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele with argument → SURVIVED
Covering tests

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

48

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.singlepointarithmetic.IntChromosomeSinglePointArithmeticTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.singlepointarithmetic.IntChromosomeSinglePointArithmeticTest]/[method:combineTest()]
replaced call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getAllele with argument → KILLED

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

50

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

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

3.3
Location : combine
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

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

51

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

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

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

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

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

52

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

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

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

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

5.5
Location : combine
Killed by : none
Replaced double subtraction with addition → SURVIVED
Covering tests

54

1.1
Location : combine
Killed by : none
Replaced double addition with subtraction → SURVIVED
Covering tests

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

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

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

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

55

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

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

3.3
Location : combine
Killed by : none
Replaced double subtraction with addition → SURVIVED
Covering tests

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

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

59

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

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

60

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

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

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

62

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

63

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

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

Active mutators

Tests examined


Report generated by PIT 1.25.7 support