1
|
|
package net.bmahe.genetics4j.core.combination.erx; |
2
|
|
|
3
|
|
import java.util.random.RandomGenerator; |
4
|
|
|
5
|
|
import org.apache.commons.lang3.Validate; |
6
|
|
|
7
|
|
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator; |
8
|
|
import net.bmahe.genetics4j.core.combination.ChromosomeCombinatorHandler; |
9
|
|
import net.bmahe.genetics4j.core.combination.ChromosomeCombinatorResolver; |
10
|
|
import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec; |
11
|
|
import net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec; |
12
|
|
import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy; |
13
|
|
import net.bmahe.genetics4j.core.spec.combination.EdgeRecombinationCrossover; |
14
|
|
|
15
|
|
public class EdgeRecombinationCrossoverHandler<T extends Comparable<T>> implements ChromosomeCombinatorHandler<T> { |
16
|
|
|
17
|
|
private final RandomGenerator randomGenerator; |
18
|
|
|
19
|
|
public EdgeRecombinationCrossoverHandler(final RandomGenerator _randomGenerator) { |
20
|
|
Validate.notNull(_randomGenerator); |
21
|
|
|
22
|
1
1. <init> : Removed assignment to member variable randomGenerator → SURVIVED
|
this.randomGenerator = _randomGenerator; |
23
|
|
} |
24
|
|
|
25
|
|
@Override |
26
|
|
public boolean canHandle(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver, |
27
|
|
final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) { |
28
|
|
Validate.notNull(combinationPolicy); |
29
|
|
Validate.notNull(chromosome); |
30
|
|
|
31
|
9
1. canHandle : negated conditional → NO_COVERAGE
2. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
3. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
4. canHandle : Substituted 1 with 0 → NO_COVERAGE
5. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
6. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
7. canHandle : Substituted 0 with 1 → NO_COVERAGE
8. canHandle : negated conditional → NO_COVERAGE
9. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::canHandle → NO_COVERAGE
|
return combinationPolicy instanceof EdgeRecombinationCrossover && chromosome instanceof IntChromosomeSpec; |
32
|
|
} |
33
|
|
|
34
|
|
@Override |
35
|
|
public ChromosomeCombinator<T> resolve(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver, |
36
|
|
final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) { |
37
|
|
Validate.notNull(chromosomeCombinatorResolver); |
38
|
|
Validate.notNull(combinationPolicy); |
39
|
|
Validate.notNull(chromosome); |
40
|
|
Validate.isTrue(canHandle(chromosomeCombinatorResolver, combinationPolicy, chromosome)); |
41
|
|
|
42
|
2
1. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::resolve → NO_COVERAGE
2. resolve : removed call to net/bmahe/genetics4j/core/combination/erx/IntEdgeRecombinationCrossover::<init> → NO_COVERAGE
|
return new IntEdgeRecombinationCrossover<T>(randomGenerator); |
43
|
|
} |
44
|
|
} |
| | Mutations |
22 |
|
1.1 Location : <init> Killed by : none Removed assignment to member variable randomGenerator → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
- net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoOffspringSelector()]
- net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoElitismSpec()]
- net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
- net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest]/[method:selectMaximizing()]
- net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:simple()]
- net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:selectMinimize()]
- net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:atLeastSpecified()]
- net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
- net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest]/[method:selectMinimizing()]
- net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
- net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMaximizeAndDoFitnessLast()]
- net.bmahe.genetics4j.core.selection.ProportionalTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.ProportionalTournamentSelectionPolicyHandlerTest]/[method:selectMinimize()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testGetterMethods()]
- net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMinimize()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
- net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
- net.bmahe.genetics4j.core.selection.RandomSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.RandomSelectionPolicyHandlerTest]/[method:select()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvaluateOnce()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvaluateOnceWithDifferentGenerations()]
- net.bmahe.genetics4j.core.selection.ProportionalTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.ProportionalTournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithPostEvaluationProcessor()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithBitChromosome()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithImmediateTermination()]
|
31 |
|
1.1 Location : canHandle Killed by : none negated conditional → NO_COVERAGE
2.2 Location : canHandle Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
3.3 Location : canHandle Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
4.4 Location : canHandle Killed by : none Substituted 1 with 0 → NO_COVERAGE
5.5 Location : canHandle Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
6.6 Location : canHandle Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
7.7 Location : canHandle Killed by : none Substituted 0 with 1 → NO_COVERAGE
8.8 Location : canHandle Killed by : none negated conditional → NO_COVERAGE
9.9 Location : canHandle Killed by : none replaced boolean return with true for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::canHandle → NO_COVERAGE
|
42 |
|
1.1 Location : resolve Killed by : none replaced return value with null for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::resolve → NO_COVERAGE
2.2 Location : resolve Killed by : none removed call to net/bmahe/genetics4j/core/combination/erx/IntEdgeRecombinationCrossover::<init> → NO_COVERAGE
|