1 | package net.bmahe.genetics4j.extras.evolutionlisteners; | |
2 | ||
3 | import java.io.IOException; | |
4 | import java.nio.charset.StandardCharsets; | |
5 | import java.nio.file.Path; | |
6 | import java.util.Comparator; | |
7 | import java.util.List; | |
8 | import java.util.Optional; | |
9 | import java.util.function.Function; | |
10 | import java.util.stream.Collectors; | |
11 | import java.util.stream.IntStream; | |
12 | import java.util.stream.Stream; | |
13 | ||
14 | import org.apache.commons.csv.CSVFormat; | |
15 | import org.apache.commons.csv.CSVPrinter; | |
16 | import org.apache.commons.lang3.Validate; | |
17 | import org.apache.logging.log4j.LogManager; | |
18 | import org.apache.logging.log4j.Logger; | |
19 | import org.immutables.value.Value; | |
20 | ||
21 | import net.bmahe.genetics4j.core.Genotype; | |
22 | import net.bmahe.genetics4j.core.evolutionlisteners.EvolutionListener; | |
23 | ||
24 | /** | |
25 | * Evolution Listener which writes the output of each generation to a CSV file | |
26 | * | |
27 | * @author bruno | |
28 | * | |
29 | * @param <T> Fitness type | |
30 | * @param <U> Data type written to the CSV | |
31 | */ | |
32 | @Value.Immutable | |
33 | public abstract class CSVEvolutionListener<T extends Comparable<T>, U> implements EvolutionListener<T> { | |
34 | final static public Logger logger = LogManager.getLogger(CSVEvolutionListener.class); | |
35 | ||
36 | public static final boolean DEFAULT_AUTO_FLUSH = true; | |
37 | ||
38 | private CSVPrinter csvPrinter; | |
39 | ||
40 | protected CSVPrinter openPrinter() { | |
41 | ||
42 |
2
1. openPrinter : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::columnExtractors → NO_COVERAGE 2. openPrinter : removed call to java/util/List::stream → NO_COVERAGE |
final List<String> headers = columnExtractors().stream() |
43 |
4
1. lambda$openPrinter$0 : replaced return value with "" for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$openPrinter$0 → NO_COVERAGE 2. lambda$openPrinter$0 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ColumnExtractor::header → NO_COVERAGE 3. openPrinter : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE 4. openPrinter : removed call to java/util/stream/Stream::map → NO_COVERAGE |
.map(ce -> ce.header()) |
44 |
2
1. openPrinter : removed call to java/util/stream/Stream::collect → NO_COVERAGE 2. openPrinter : removed call to java/util/stream/Collectors::toUnmodifiableList → NO_COVERAGE |
.collect(Collectors.toUnmodifiableList()); |
45 | ||
46 | try { | |
47 |
4
1. openPrinter : replaced call to org/apache/commons/csv/CSVFormat::withAutoFlush with receiver → NO_COVERAGE 2. openPrinter : removed call to org/apache/commons/csv/CSVFormat::withAutoFlush → NO_COVERAGE 3. openPrinter : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::autoFlush → NO_COVERAGE 4. openPrinter : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::openPrinter → NO_COVERAGE |
return CSVFormat.DEFAULT.withAutoFlush(autoFlush()) |
48 |
5
1. openPrinter : removed call to java/util/List::size → NO_COVERAGE 2. openPrinter : replaced call to org/apache/commons/csv/CSVFormat::withHeader with receiver → NO_COVERAGE 3. openPrinter : removed call to java/util/List::toArray → NO_COVERAGE 4. openPrinter : replaced call to java/util/List::toArray with argument → NO_COVERAGE 5. openPrinter : removed call to org/apache/commons/csv/CSVFormat::withHeader → NO_COVERAGE |
.withHeader(headers.toArray(new String[headers.size()])) |
49 |
4
1. openPrinter : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::filename → NO_COVERAGE 2. openPrinter : removed call to java/nio/file/Path::of → NO_COVERAGE 3. openPrinter : removed call to org/apache/commons/csv/CSVFormat::print → NO_COVERAGE 4. openPrinter : Substituted 0 with 1 → NO_COVERAGE |
.print(Path.of(filename()), StandardCharsets.UTF_8); |
50 | } catch (IOException e) { | |
51 | logger.error("Could not open {}", filename(), e); | |
52 |
2
1. openPrinter : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::filename → NO_COVERAGE 2. openPrinter : removed call to java/lang/RuntimeException::<init> → NO_COVERAGE |
throw new RuntimeException("Could not open file " + filename(), e); |
53 | } | |
54 | ||
55 | } | |
56 | ||
57 | /** | |
58 | * Whether or not the CSV writer has auto flush enabled. Defaults to {@value #DEFAULT_AUTO_FLUSH} | |
59 | * | |
60 | * @return | |
61 | */ | |
62 | @Value.Default | |
63 | public boolean autoFlush() { | |
64 |
2
1. autoFlush : replaced boolean return with false for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::autoFlush → NO_COVERAGE 2. autoFlush : Substituted 1 with 0 → NO_COVERAGE |
return DEFAULT_AUTO_FLUSH; |
65 | } | |
66 | ||
67 | /** | |
68 | * User defined function to provide some additional information when computing the value to write. Defaults to null | |
69 | * | |
70 | * @return | |
71 | */ | |
72 | @Value.Default | |
73 | public GenerationFunction<T, U> evolutionContextSupplier() { | |
74 |
1
1. evolutionContextSupplier : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::evolutionContextSupplier → NO_COVERAGE |
return (generation, population, fitness, isDone) -> null; |
75 | } | |
76 | ||
77 | /** | |
78 | * How many generations to skip between each writes. Defaults to writing every generations | |
79 | * | |
80 | * @return | |
81 | */ | |
82 | @Value.Default | |
83 | public int skipN() { | |
84 |
1
1. skipN : Substituted 0 with 1 → NO_COVERAGE |
return 0; |
85 | } | |
86 | ||
87 | /** | |
88 | * Users can supply an optional set of filters to control which individuals get written and in which order. Default | |
89 | * to have no impact. | |
90 | * | |
91 | * @return | |
92 | */ | |
93 | @Value.Default | |
94 | public Function<Stream<EvolutionStep<T, U>>, Stream<EvolutionStep<T, U>>> filter() { | |
95 |
2
1. lambda$filter$2 : replaced return value with Stream.empty for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$filter$2 → NO_COVERAGE 2. filter : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::filter → NO_COVERAGE |
return (stream) -> stream; |
96 | } | |
97 | ||
98 | /** | |
99 | * Destination file name for the CSV file | |
100 | * | |
101 | * @return | |
102 | */ | |
103 | @Value.Parameter | |
104 | public abstract String filename(); | |
105 | ||
106 | /** | |
107 | * List of Column Extractors. They specify how and what to write from each individual at a given generation | |
108 | * | |
109 | * @return | |
110 | */ | |
111 | @Value.Parameter | |
112 | public abstract List<ColumnExtractor<T, U>> columnExtractors(); | |
113 | ||
114 | @Override | |
115 | public void onEvolution(final long generation, final List<Genotype> population, final List<T> fitness, | |
116 | final boolean isDone) { | |
117 | Validate.isTrue(generation >= 0); | |
118 | Validate.notNull(population); | |
119 | Validate.notNull(fitness); | |
120 | Validate.isTrue(population.size() > 0); | |
121 | Validate.isTrue(population.size() == fitness.size()); | |
122 | ||
123 |
14
1. onEvolution : Replaced long modulus with multiplication → NO_COVERAGE 2. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::skipN → NO_COVERAGE 3. onEvolution : Substituted 0 with 1 → NO_COVERAGE 4. onEvolution : removed conditional - replaced equality check with false → NO_COVERAGE 5. onEvolution : removed conditional - replaced equality check with true → NO_COVERAGE 6. onEvolution : removed conditional - replaced comparison check with false → NO_COVERAGE 7. onEvolution : removed conditional - replaced equality check with true → NO_COVERAGE 8. onEvolution : removed conditional - replaced comparison check with true → NO_COVERAGE 9. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::skipN → NO_COVERAGE 10. onEvolution : negated conditional → NO_COVERAGE 11. onEvolution : negated conditional → NO_COVERAGE 12. onEvolution : negated conditional → NO_COVERAGE 13. onEvolution : changed conditional boundary → NO_COVERAGE 14. onEvolution : removed conditional - replaced equality check with false → NO_COVERAGE |
if (isDone == false && skipN() > 0 && generation % skipN() != 0) { |
124 | return; | |
125 | } | |
126 | ||
127 |
3
1. onEvolution : removed conditional - replaced equality check with true → NO_COVERAGE 2. onEvolution : removed conditional - replaced equality check with false → NO_COVERAGE 3. onEvolution : negated conditional → NO_COVERAGE |
if (csvPrinter == null) { |
128 |
2
1. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::openPrinter → NO_COVERAGE 2. onEvolution : Removed assignment to member variable csvPrinter → NO_COVERAGE |
csvPrinter = openPrinter(); |
129 | } | |
130 | ||
131 | final Optional<U> context = Optional | |
132 |
3
1. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/GenerationFunction::apply → NO_COVERAGE 2. onEvolution : removed call to java/util/Optional::ofNullable → NO_COVERAGE 3. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::evolutionContextSupplier → NO_COVERAGE |
.ofNullable(evolutionContextSupplier().apply(generation, population, fitness, isDone)); |
133 | ||
134 |
3
1. onEvolution : Substituted 0 with 1 → NO_COVERAGE 2. onEvolution : removed call to java/util/List::size → NO_COVERAGE 3. onEvolution : removed call to java/util/stream/IntStream::range → NO_COVERAGE |
final var rawIndividualStream = IntStream.range(0, population.size()) |
135 |
1
1. onEvolution : removed call to java/util/stream/IntStream::boxed → NO_COVERAGE |
.boxed() |
136 |
4
1. onEvolution : removed call to java/util/stream/Stream::map → NO_COVERAGE 2. lambda$onEvolution$3 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/EvolutionStep::of → NO_COVERAGE 3. onEvolution : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE 4. lambda$onEvolution$3 : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$onEvolution$3 → NO_COVERAGE |
.map(individualIndex -> EvolutionStep.of(context, |
137 | generation, | |
138 |
1
1. lambda$onEvolution$3 : removed call to java/lang/Integer::intValue → NO_COVERAGE |
individualIndex, |
139 |
2
1. lambda$onEvolution$3 : removed call to java/lang/Integer::intValue → NO_COVERAGE 2. lambda$onEvolution$3 : removed call to java/util/List::get → NO_COVERAGE |
population.get(individualIndex), |
140 |
2
1. lambda$onEvolution$3 : removed call to java/lang/Integer::intValue → NO_COVERAGE 2. lambda$onEvolution$3 : removed call to java/util/List::get → NO_COVERAGE |
fitness.get(individualIndex), |
141 | isDone)); | |
142 | ||
143 |
3
1. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::filter → NO_COVERAGE 2. onEvolution : removed call to java/util/function/Function::apply → NO_COVERAGE 3. onEvolution : replaced call to java/util/function/Function::apply with argument → NO_COVERAGE |
final var filteredStream = filter().apply(rawIndividualStream); |
144 | ||
145 |
1
1. onEvolution : removed call to java/util/stream/Stream::forEach → NO_COVERAGE |
filteredStream.forEach(evolutionStep -> { |
146 |
2
1. lambda$onEvolution$6 : removed call to java/util/List::stream → NO_COVERAGE 2. lambda$onEvolution$6 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::columnExtractors → NO_COVERAGE |
final List<Object> columnValues = columnExtractors().stream() |
147 |
4
1. lambda$onEvolution$4 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ColumnExtractor::columnExtractorFunction → NO_COVERAGE 2. lambda$onEvolution$4 : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$onEvolution$4 → NO_COVERAGE 3. lambda$onEvolution$6 : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE 4. lambda$onEvolution$6 : removed call to java/util/stream/Stream::map → NO_COVERAGE |
.map(ce -> ce.columnExtractorFunction()) |
148 |
4
1. lambda$onEvolution$6 : replaced call to java/util/stream/Stream::map with receiver → NO_COVERAGE 2. lambda$onEvolution$5 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ColumnExtractorFunction::apply → NO_COVERAGE 3. lambda$onEvolution$6 : removed call to java/util/stream/Stream::map → NO_COVERAGE 4. lambda$onEvolution$5 : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$onEvolution$5 → NO_COVERAGE |
.map(cef -> cef.apply(evolutionStep)) |
149 |
2
1. lambda$onEvolution$6 : removed call to java/util/stream/Stream::collect → NO_COVERAGE 2. lambda$onEvolution$6 : removed call to java/util/stream/Collectors::toUnmodifiableList → NO_COVERAGE |
.collect(Collectors.toUnmodifiableList()); |
150 | ||
151 | try { | |
152 |
1
1. lambda$onEvolution$6 : removed call to org/apache/commons/csv/CSVPrinter::printRecord → NO_COVERAGE |
csvPrinter.printRecord(columnValues); |
153 | } catch (IOException e1) { | |
154 | logger.error("Could not write values: {}", columnValues, e1); | |
155 |
2
1. lambda$onEvolution$6 : removed call to java/lang/String::valueOf → NO_COVERAGE 2. lambda$onEvolution$6 : removed call to java/lang/RuntimeException::<init> → NO_COVERAGE |
throw new RuntimeException("Could not write values: " + columnValues, e1); |
156 | } | |
157 | }); | |
158 | ||
159 |
6
1. onEvolution : negated conditional → NO_COVERAGE 2. onEvolution : removed conditional - replaced equality check with false → NO_COVERAGE 3. onEvolution : removed conditional - replaced equality check with false → NO_COVERAGE 4. onEvolution : removed conditional - replaced equality check with true → NO_COVERAGE 5. onEvolution : removed conditional - replaced equality check with true → NO_COVERAGE 6. onEvolution : negated conditional → NO_COVERAGE |
if (isDone && csvPrinter != null) { |
160 | try { | |
161 |
2
1. onEvolution : removed call to org/apache/commons/csv/CSVPrinter::close → NO_COVERAGE 2. onEvolution : Substituted 1 with 0 → NO_COVERAGE |
csvPrinter.close(true); |
162 | } catch (IOException e) { | |
163 | logger.error("Could not close CSV printer for filename {}", filename(), e); | |
164 |
2
1. onEvolution : removed call to java/lang/RuntimeException::<init> → NO_COVERAGE 2. onEvolution : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::filename → NO_COVERAGE |
throw new RuntimeException("Could not close CSV printer for filename " + filename(), e); |
165 | } | |
166 | } | |
167 | } | |
168 | ||
169 | public static class Builder<T extends Comparable<T>, U> extends ImmutableCSVEvolutionListener.Builder<T, U> { | |
170 | } | |
171 | ||
172 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> of(String filename, | |
173 | List<ColumnExtractor<T, U>> columnExtractors) { | |
174 |
2
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ImmutableCSVEvolutionListener::of → NO_COVERAGE 2. of : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::of → NO_COVERAGE |
return ImmutableCSVEvolutionListener.of(filename, (Iterable<? extends ColumnExtractor<T, U>>) columnExtractors); |
175 | } | |
176 | ||
177 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> of(String filename, | |
178 | Iterable<? extends ColumnExtractor<T, U>> columnExtractors) { | |
179 |
2
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ImmutableCSVEvolutionListener::of → NO_COVERAGE 2. of : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::of → NO_COVERAGE |
return ImmutableCSVEvolutionListener.of(filename, columnExtractors); |
180 | } | |
181 | ||
182 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> of(final String filename, | |
183 | final GenerationFunction<T, U> evolutionContextSupplier, | |
184 | final Iterable<? extends ColumnExtractor<T, U>> columnExtractors) { | |
185 |
1
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::<init> → NO_COVERAGE |
var csvEvolutionListenerBuilder = new CSVEvolutionListener.Builder<T, U>(); |
186 | ||
187 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename → NO_COVERAGE |
csvEvolutionListenerBuilder.filename(filename) |
188 |
2
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier → NO_COVERAGE 2. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier with receiver → NO_COVERAGE |
.evolutionContextSupplier(evolutionContextSupplier) |
189 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors → NO_COVERAGE |
.addAllColumnExtractors(columnExtractors); |
190 | ||
191 |
2
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::build → NO_COVERAGE 2. of : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::of → NO_COVERAGE |
return csvEvolutionListenerBuilder.build(); |
192 | } | |
193 | ||
194 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> of(final String filename, | |
195 | final GenerationFunction<T, U> evolutionContextSupplier, | |
196 | final Iterable<? extends ColumnExtractor<T, U>> columnExtractors, final int skipN) { | |
197 |
1
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::<init> → NO_COVERAGE |
var csvEvolutionListenerBuilder = new CSVEvolutionListener.Builder<T, U>(); |
198 | ||
199 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename → NO_COVERAGE |
csvEvolutionListenerBuilder.filename(filename) |
200 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier → NO_COVERAGE |
.evolutionContextSupplier(evolutionContextSupplier) |
201 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors → NO_COVERAGE |
.addAllColumnExtractors(columnExtractors) |
202 |
2
1. of : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::skipN with receiver → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::skipN → NO_COVERAGE |
.skipN(skipN); |
203 | ||
204 |
2
1. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::build → NO_COVERAGE 2. of : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::of → NO_COVERAGE |
return csvEvolutionListenerBuilder.build(); |
205 | } | |
206 | ||
207 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> ofTopN(final String filename, | |
208 | final GenerationFunction<T, U> evolutionContextSupplier, | |
209 | final Iterable<? extends ColumnExtractor<T, U>> columnExtractors, final Comparator<T> comparator, | |
210 | final int topN) { | |
211 |
1
1. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::<init> → NO_COVERAGE |
var csvEvolutionListenerBuilder = new CSVEvolutionListener.Builder<T, U>(); |
212 | ||
213 |
2
1. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename → NO_COVERAGE 2. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename with receiver → NO_COVERAGE |
csvEvolutionListenerBuilder.filename(filename) |
214 |
2
1. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier with receiver → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier → NO_COVERAGE |
.evolutionContextSupplier(evolutionContextSupplier) |
215 |
2
1. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors with receiver → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors → NO_COVERAGE |
.addAllColumnExtractors(columnExtractors) |
216 |
8
1. lambda$ofTopN$7 : replaced call to java/util/Comparator::reversed with receiver → NO_COVERAGE 2. lambda$ofTopN$8 : replaced return value with Stream.empty for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$ofTopN$8 → NO_COVERAGE 3. lambda$ofTopN$8 : removed call to java/util/stream/Stream::sorted → NO_COVERAGE 4. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filter with receiver → NO_COVERAGE 5. lambda$ofTopN$7 : removed call to java/util/Comparator::reversed → NO_COVERAGE 6. lambda$ofTopN$8 : replaced call to java/util/stream/Stream::sorted with receiver → NO_COVERAGE 7. lambda$ofTopN$7 : replaced int return with 0 for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$ofTopN$7 → NO_COVERAGE 8. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filter → NO_COVERAGE |
.filter(stream -> stream.sorted((a, b) -> comparator.reversed() |
217 |
3
1. lambda$ofTopN$7 : removed call to java/util/Comparator::compare → NO_COVERAGE 2. lambda$ofTopN$7 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/EvolutionStep::fitness → NO_COVERAGE 3. lambda$ofTopN$7 : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/EvolutionStep::fitness → NO_COVERAGE |
.compare(a.fitness(), b.fitness())) |
218 |
2
1. lambda$ofTopN$8 : replaced call to java/util/stream/Stream::limit with receiver → NO_COVERAGE 2. lambda$ofTopN$8 : removed call to java/util/stream/Stream::limit → NO_COVERAGE |
.limit(topN)); |
219 | ||
220 |
2
1. ofTopN : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::ofTopN → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::build → NO_COVERAGE |
return csvEvolutionListenerBuilder.build(); |
221 | } | |
222 | ||
223 | public static <T extends Comparable<T>, U> CSVEvolutionListener<T, U> ofTopN(final String filename, | |
224 | final GenerationFunction<T, U> evolutionContextSupplier, | |
225 | final Iterable<? extends ColumnExtractor<T, U>> columnExtractors, final int topN) { | |
226 |
1
1. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::<init> → NO_COVERAGE |
var csvEvolutionListenerBuilder = new CSVEvolutionListener.Builder<T, U>(); |
227 | ||
228 |
2
1. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename with receiver → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filename → NO_COVERAGE |
csvEvolutionListenerBuilder.filename(filename) |
229 |
2
1. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier → NO_COVERAGE 2. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::evolutionContextSupplier with receiver → NO_COVERAGE |
.evolutionContextSupplier(evolutionContextSupplier) |
230 |
2
1. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors with receiver → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::addAllColumnExtractors → NO_COVERAGE |
.addAllColumnExtractors(columnExtractors) |
231 |
6
1. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filter → NO_COVERAGE 2. lambda$ofTopN$9 : replaced return value with Stream.empty for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::lambda$ofTopN$9 → NO_COVERAGE 3. lambda$ofTopN$9 : replaced call to java/util/stream/Stream::sorted with receiver → NO_COVERAGE 4. lambda$ofTopN$9 : removed call to java/util/Comparator::comparing → NO_COVERAGE 5. lambda$ofTopN$9 : removed call to java/util/stream/Stream::sorted → NO_COVERAGE 6. ofTopN : replaced call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::filter with receiver → NO_COVERAGE |
.filter(stream -> stream.sorted(Comparator.comparing(EvolutionStep::fitness)) |
232 |
2
1. lambda$ofTopN$9 : removed call to java/util/stream/Stream::limit → NO_COVERAGE 2. lambda$ofTopN$9 : replaced call to java/util/stream/Stream::limit with receiver → NO_COVERAGE |
.limit(topN)); |
233 | ||
234 |
2
1. ofTopN : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener::ofTopN → NO_COVERAGE 2. ofTopN : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/CSVEvolutionListener$Builder::build → NO_COVERAGE |
return csvEvolutionListenerBuilder.build(); |
235 | } | |
236 | } | |
Mutations | ||
42 |
1.1 2.2 |
|
43 |
1.1 2.2 3.3 4.4 |
|
44 |
1.1 2.2 |
|
47 |
1.1 2.2 3.3 4.4 |
|
48 |
1.1 2.2 3.3 4.4 5.5 |
|
49 |
1.1 2.2 3.3 4.4 |
|
52 |
1.1 2.2 |
|
64 |
1.1 2.2 |
|
74 |
1.1 |
|
84 |
1.1 |
|
95 |
1.1 2.2 |
|
123 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 |
|
127 |
1.1 2.2 3.3 |
|
128 |
1.1 2.2 |
|
132 |
1.1 2.2 3.3 |
|
134 |
1.1 2.2 3.3 |
|
135 |
1.1 |
|
136 |
1.1 2.2 3.3 4.4 |
|
138 |
1.1 |
|
139 |
1.1 2.2 |
|
140 |
1.1 2.2 |
|
143 |
1.1 2.2 3.3 |
|
145 |
1.1 |
|
146 |
1.1 2.2 |
|
147 |
1.1 2.2 3.3 4.4 |
|
148 |
1.1 2.2 3.3 4.4 |
|
149 |
1.1 2.2 |
|
152 |
1.1 |
|
155 |
1.1 2.2 |
|
159 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
161 |
1.1 2.2 |
|
164 |
1.1 2.2 |
|
174 |
1.1 2.2 |
|
179 |
1.1 2.2 |
|
185 |
1.1 |
|
187 |
1.1 2.2 |
|
188 |
1.1 2.2 |
|
189 |
1.1 2.2 |
|
191 |
1.1 2.2 |
|
197 |
1.1 |
|
199 |
1.1 2.2 |
|
200 |
1.1 2.2 |
|
201 |
1.1 2.2 |
|
202 |
1.1 2.2 |
|
204 |
1.1 2.2 |
|
211 |
1.1 |
|
213 |
1.1 2.2 |
|
214 |
1.1 2.2 |
|
215 |
1.1 2.2 |
|
216 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 |
|
217 |
1.1 2.2 3.3 |
|
218 |
1.1 2.2 |
|
220 |
1.1 2.2 |
|
226 |
1.1 |
|
228 |
1.1 2.2 |
|
229 |
1.1 2.2 |
|
230 |
1.1 2.2 |
|
231 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
232 |
1.1 2.2 |
|
234 |
1.1 2.2 |