|
1
|
|
package net.bmahe.genetics4j.core.combination.multicombinations; |
|
2
|
|
|
|
3
|
|
import java.util.List; |
|
4
|
|
import java.util.Objects; |
|
5
|
|
import java.util.random.RandomGenerator; |
|
6
|
|
|
|
7
|
|
import net.bmahe.genetics4j.core.chromosomes.Chromosome; |
|
8
|
|
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator; |
|
9
|
|
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration; |
|
10
|
|
|
|
11
|
|
public class MultiChromosomeCombinations<T extends Comparable<T>> implements ChromosomeCombinator<T> { |
|
12
|
|
|
|
13
|
|
private final RandomGenerator randomGenerator; |
|
14
|
|
private final List<ChromosomeCombinator<T>> chromosomeCombinators; |
|
15
|
|
|
|
16
|
|
public MultiChromosomeCombinations(final RandomGenerator _randomGenerator, |
|
17
|
|
final List<ChromosomeCombinator<T>> _chromosomeCombinators) { |
|
18
|
|
Objects.requireNonNull(_randomGenerator); |
|
19
|
|
Objects.requireNonNull(_chromosomeCombinators); |
|
20
|
|
|
|
21
|
1
1. <init> : Removed assignment to member variable randomGenerator → KILLED
|
this.randomGenerator = _randomGenerator; |
|
22
|
1
1. <init> : Removed assignment to member variable chromosomeCombinators → KILLED
|
this.chromosomeCombinators = _chromosomeCombinators; |
|
23
|
|
} |
|
24
|
|
|
|
25
|
|
@Override |
|
26
|
|
public List<Chromosome> combine(final AbstractEAConfiguration<T> eaConfiguration, final Chromosome chromosome1, |
|
27
|
|
final T firstParentFitness, final Chromosome chromosome2, final T secondParentFitness) { |
|
28
|
|
|
|
29
|
3
1. combine : removed call to java/util/List::size → SURVIVED
2. combine : removed call to java/util/random/RandomGenerator::nextInt → SURVIVED
3. combine : replaced call to java/util/random/RandomGenerator::nextInt with argument → KILLED
|
final int chromosomeCombinatorIndex = randomGenerator.nextInt(chromosomeCombinators.size()); |
|
30
|
1
1. combine : removed call to java/util/List::get → KILLED
|
final ChromosomeCombinator<T> chromosomeCombinator = chromosomeCombinators.get(chromosomeCombinatorIndex); |
|
31
|
|
|
|
32
|
1
1. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/multicombinations/MultiChromosomeCombinations::combine → KILLED
|
return chromosomeCombinator |
|
33
|
1
1. combine : removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinator::combine → KILLED
|
.combine(eaConfiguration, chromosome1, firstParentFitness, chromosome2, secondParentFitness); |
|
34
|
|
} |
|
35
|
|
|
|
36
|
|
} |
| | Mutations |
| 21 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] Removed assignment to member variable randomGenerator → KILLED
|
| 22 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] Removed assignment to member variable chromosomeCombinators → KILLED
|
| 29 |
|
1.1 Location : combine Killed by : none removed call to java/util/List::size → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()]
2.2 Location : combine Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] replaced call to java/util/random/RandomGenerator::nextInt with argument → KILLED
3.3 Location : combine Killed by : none removed call to java/util/random/RandomGenerator::nextInt → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()]
|
| 30 |
|
1.1 Location : combine Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] removed call to java/util/List::get → KILLED
|
| 32 |
|
1.1 Location : combine Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/multicombinations/MultiChromosomeCombinations::combine → KILLED
|
| 33 |
|
1.1 Location : combine Killed by : net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.multicombinations.MultiCombinationsHandlerTest]/[method:resolvePicksRandomCombinator()] removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinator::combine → KILLED
|