1
|
|
package net.bmahe.genetics4j.core.selection; |
2
|
|
|
3
|
|
import java.util.Objects; |
4
|
|
import java.util.random.RandomGenerator; |
5
|
|
|
6
|
|
import org.apache.commons.lang3.Validate; |
7
|
|
|
8
|
|
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration; |
9
|
|
import net.bmahe.genetics4j.core.spec.AbstractEAExecutionContext; |
10
|
|
import net.bmahe.genetics4j.core.spec.selection.SelectionPolicy; |
11
|
|
import net.bmahe.genetics4j.core.spec.selection.SelectiveRefinementTournament; |
12
|
|
|
13
|
|
public class SelectiveRefinementTournamentPolicyHandler<T extends Comparable<T>> implements SelectionPolicyHandler<T> { |
14
|
|
private final RandomGenerator randomGenerator; |
15
|
|
|
16
|
|
public SelectiveRefinementTournamentPolicyHandler(final RandomGenerator _randomGenerator) { |
17
|
|
Objects.requireNonNull(_randomGenerator); |
18
|
|
|
19
|
1
1. <init> : Removed assignment to member variable randomGenerator → SURVIVED
|
this.randomGenerator = _randomGenerator; |
20
|
|
} |
21
|
|
|
22
|
|
@Override |
23
|
|
public boolean canHandle(final SelectionPolicy selectionPolicy) { |
24
|
|
Objects.requireNonNull(selectionPolicy); |
25
|
|
|
26
|
2
1. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::canHandle → NO_COVERAGE
2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::canHandle → NO_COVERAGE
|
return selectionPolicy instanceof SelectiveRefinementTournament; |
27
|
|
} |
28
|
|
|
29
|
|
@SuppressWarnings("unchecked") |
30
|
|
@Override |
31
|
|
public Selector<T> resolve(final AbstractEAExecutionContext<T> eaExecutionContext, |
32
|
|
final AbstractEAConfiguration<T> eaConfiguration, |
33
|
|
final SelectionPolicyHandlerResolver<T> selectionPolicyHandlerResolver, |
34
|
|
final SelectionPolicy selectionPolicy) { |
35
|
|
Objects.requireNonNull(selectionPolicy); |
36
|
|
Validate.isInstanceOf(SelectiveRefinementTournament.class, selectionPolicy); |
37
|
|
|
38
|
2
1. resolve : replaced return value with null for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::resolve → NO_COVERAGE
2. resolve : removed call to net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentSelector::<init> → NO_COVERAGE
|
return new SelectiveRefinementTournamentSelector<T>((SelectiveRefinementTournament<T>) selectionPolicy, |
39
|
|
randomGenerator); |
40
|
|
} |
41
|
|
} |
| | Mutations |
19 |
|
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.RandomSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.RandomSelectionPolicyHandlerTest]/[method:select()]
- 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.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
- net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandlerTest]/[method:selectMinimizing()]
- net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:testVirtualThreadFactory()]
- 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:testSystemConstruction()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testGetterMethods()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvaluateOnceWithDifferentGenerations()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvaluateOnce()]
- net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
- 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:testEvolveWithIntChromosome()]
- 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:testEvolveWithBitChromosome()]
- net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithImmediateTermination()]
|
26 |
|
1.1 Location : canHandle Killed by : none replaced boolean return with true for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::canHandle → NO_COVERAGE
2.2 Location : canHandle Killed by : none replaced boolean return with false for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::canHandle → NO_COVERAGE
|
38 |
|
1.1 Location : resolve Killed by : none replaced return value with null for net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentPolicyHandler::resolve → NO_COVERAGE
2.2 Location : resolve Killed by : none removed call to net/bmahe/genetics4j/core/selection/SelectiveRefinementTournamentSelector::<init> → NO_COVERAGE
|