|
1
|
|
package net.bmahe.genetics4j.core.spec; |
|
2
|
|
|
|
3
|
|
import java.util.Comparator; |
|
4
|
|
import java.util.List; |
|
5
|
|
import java.util.Objects; |
|
6
|
|
import java.util.Optional; |
|
7
|
|
import java.util.stream.IntStream; |
|
8
|
|
|
|
9
|
|
import org.apache.commons.lang3.Validate; |
|
10
|
|
import org.immutables.value.Value; |
|
11
|
|
|
|
12
|
|
import net.bmahe.genetics4j.core.Genotype; |
|
13
|
|
|
|
14
|
|
@Value.Immutable |
|
15
|
|
public abstract class EvolutionResult<T extends Comparable<T>> { |
|
16
|
|
|
|
17
|
|
@Value.Parameter |
|
18
|
|
public abstract AbstractEAConfiguration<T> eaConfiguration(); |
|
19
|
|
|
|
20
|
|
@Value.Parameter |
|
21
|
|
public abstract long generation(); |
|
22
|
|
|
|
23
|
|
@Value.Parameter |
|
24
|
|
public abstract List<Genotype> population(); |
|
25
|
|
|
|
26
|
|
@Value.Parameter |
|
27
|
|
public abstract List<T> fitness(); |
|
28
|
|
|
|
29
|
|
@Value.Derived |
|
30
|
|
public GenotypeFitness<T> bestIndividual() { |
|
31
|
|
|
|
32
|
1
1. bestIndividual : removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::population → KILLED
|
final List<Genotype> population = population(); |
|
33
|
1
1. bestIndividual : removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::fitness → KILLED
|
final List<T> fitness = fitness(); |
|
34
|
|
|
|
35
|
|
Objects.requireNonNull(population); |
|
36
|
|
Objects.requireNonNull(fitness); |
|
37
|
|
Validate.isTrue(population.size() == fitness.size()); |
|
38
|
|
Validate.isTrue(population.size() > 0); |
|
39
|
|
|
|
40
|
2
1. bestIndividual : removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::fitnessComparator → KILLED
2. bestIndividual : removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::eaConfiguration → KILLED
|
final Comparator<T> comparator = eaConfiguration().fitnessComparator(); |
|
41
|
|
|
|
42
|
3
1. bestIndividual : Substituted 0 with 1 → SURVIVED
2. bestIndividual : removed call to java/util/List::size → KILLED
3. bestIndividual : removed call to java/util/stream/IntStream::range → KILLED
|
final Optional<Integer> bestIndexOpt = IntStream.range(0, fitness.size()) |
|
43
|
1
1. bestIndividual : removed call to java/util/stream/IntStream::boxed → KILLED
|
.boxed() |
|
44
|
7
1. lambda$bestIndividual$0 : replaced int return with 0 for net/bmahe/genetics4j/core/spec/EvolutionResult::lambda$bestIndividual$0 → SURVIVED
2. lambda$bestIndividual$0 : removed call to java/lang/Integer::intValue → SURVIVED
3. lambda$bestIndividual$0 : removed call to java/lang/Integer::intValue → SURVIVED
4. lambda$bestIndividual$0 : removed call to java/util/Comparator::compare → SURVIVED
5. lambda$bestIndividual$0 : removed call to java/util/List::get → KILLED
6. bestIndividual : removed call to java/util/stream/Stream::max → KILLED
7. lambda$bestIndividual$0 : removed call to java/util/List::get → KILLED
|
.max((a, b) -> comparator.compare(fitness.get(a), fitness.get(b))); |
|
45
|
|
|
|
46
|
1
1. bestIndividual : removed call to java/util/Optional::orElseThrow → KILLED
|
final Integer bestIndex = bestIndexOpt.orElseThrow( |
|
47
|
2
1. lambda$bestIndividual$1 : replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::lambda$bestIndividual$1 → NO_COVERAGE
2. lambda$bestIndividual$1 : removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE
|
() -> new IllegalStateException("Couldn't find a best entry despite having a non-zero population")); |
|
48
|
|
|
|
49
|
6
1. bestIndividual : removed call to java/lang/Integer::intValue → SURVIVED
2. bestIndividual : removed call to java/lang/Integer::intValue → SURVIVED
3. bestIndividual : removed call to java/util/List::get → KILLED
4. bestIndividual : removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::of → KILLED
5. bestIndividual : replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
6. bestIndividual : removed call to java/util/List::get → KILLED
|
return GenotypeFitness.of(population.get(bestIndex), fitness.get(bestIndex)); |
|
50
|
|
} |
|
51
|
|
|
|
52
|
|
public Genotype bestGenotype() { |
|
53
|
3
1. bestGenotype : removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::genotype → KILLED
2. bestGenotype : replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestGenotype → KILLED
3. bestGenotype : removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
|
return bestIndividual().genotype(); |
|
54
|
|
} |
|
55
|
|
|
|
56
|
|
public T bestFitness() { |
|
57
|
3
1. bestFitness : removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
2. bestFitness : replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestFitness → KILLED
3. bestFitness : removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::fitness → KILLED
|
return bestIndividual().fitness(); |
|
58
|
|
} |
|
59
|
|
} |
| | Mutations |
| 32 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::population → KILLED
|
| 33 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::fitness → KILLED
|
| 40 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::fitnessComparator → KILLED
2.2 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::eaConfiguration → KILLED
|
| 42 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/List::size → KILLED
2.2 Location : bestIndividual Killed by : none Substituted 0 with 1 → SURVIVED
Covering tests
Covered by tests:
- 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()]
3.3 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/stream/IntStream::range → KILLED
|
| 43 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/stream/IntStream::boxed → KILLED
|
| 44 |
|
1.1 Location : lambda$bestIndividual$0 Killed by : none replaced int return with 0 for net/bmahe/genetics4j/core/spec/EvolutionResult::lambda$bestIndividual$0 → SURVIVED
Covering tests
Covered by tests:
- 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()]
2.2 Location : lambda$bestIndividual$0 Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/List::get → KILLED
3.3 Location : lambda$bestIndividual$0 Killed by : none removed call to java/lang/Integer::intValue → SURVIVED
Covering tests
Covered by tests:
- 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()]
4.4 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/stream/Stream::max → KILLED
5.5 Location : lambda$bestIndividual$0 Killed by : none removed call to java/lang/Integer::intValue → SURVIVED
Covering tests
Covered by tests:
- 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()]
6.6 Location : lambda$bestIndividual$0 Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/List::get → KILLED
7.7 Location : lambda$bestIndividual$0 Killed by : none removed call to java/util/Comparator::compare → SURVIVED
Covering tests
Covered by tests:
- 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()]
|
| 46 |
|
1.1 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/Optional::orElseThrow → KILLED
|
| 47 |
|
1.1 Location : lambda$bestIndividual$1 Killed by : none replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::lambda$bestIndividual$1 → NO_COVERAGE
2.2 Location : lambda$bestIndividual$1 Killed by : none removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE
|
| 49 |
|
1.1 Location : bestIndividual Killed by : none removed call to java/lang/Integer::intValue → SURVIVED
Covering tests
Covered by tests:
- 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()]
2.2 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/List::get → KILLED
3.3 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::of → KILLED
4.4 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
5.5 Location : bestIndividual Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to java/util/List::get → KILLED
6.6 Location : bestIndividual Killed by : none removed call to java/lang/Integer::intValue → SURVIVED
Covering tests
Covered by tests:
- 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()]
|
| 53 |
|
1.1 Location : bestGenotype Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithBitChromosome()] removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::genotype → KILLED
2.2 Location : bestGenotype Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithBitChromosome()] replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestGenotype → KILLED
3.3 Location : bestGenotype Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithBitChromosome()] removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
|
| 57 |
|
1.1 Location : bestFitness Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/EvolutionResult::bestIndividual → KILLED
2.2 Location : bestFitness Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] replaced return value with null for net/bmahe/genetics4j/core/spec/EvolutionResult::bestFitness → KILLED
3.3 Location : bestFitness Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()] removed call to net/bmahe/genetics4j/core/spec/GenotypeFitness::fitness → KILLED
|