IntChromosomeSinglePointArithmetic.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.IntChromosome;
10
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator;
11
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
12
13
public class IntChromosomeSinglePointArithmetic<T extends Comparable<T>> implements ChromosomeCombinator<T> {
14
15
	private final RandomGenerator randomGenerator;
16
	private final double alpha;
17
18
	public IntChromosomeSinglePointArithmetic(final RandomGenerator _randomGenerator, final double _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(IntChromosome.class, chromosome1);
32
		Validate.isInstanceOf(IntChromosome.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 : 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());
36
37
		final IntChromosome intChromosome1 = (IntChromosome) chromosome1;
38
		final IntChromosome intChromosome2 = (IntChromosome) chromosome2;
39
40 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/Chromosome::getNumAlleles → KILLED
		final int numAlleles = chromosome1.getNumAlleles();
41
		final int[] firstChildValues = new int[numAlleles];
42
		final int[] secondChildValues = new int[numAlleles];
43
44 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++) {
45
46 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);
47 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);
48
49 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) {
50 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);
51 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);
52
			} else {
53 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);
54 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);
55
			}
56
		}
57
58 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(
59 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),
60
				new IntChromosome(numAlleles,
61 1 1. combine : removed call to net/bmahe/genetics4j/core/chromosomes/IntChromosome::getMinValue → SURVIVED
						intChromosome1.getMinValue(),
62 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(),
63
						secondChildValues));
64
	}
65
}

Mutations

22

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

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

35

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

40

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

44

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

46

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

47

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

49

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

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

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

53

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

54

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

58

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

59

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

61

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

62

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