Accumulator key "Population Size" not defined for certain algorithms
A Free and Open Source Java Framework for Multiobjective Optimization
Brought to you by:
dhadka
Using a modified version of Example 3 (http://moeaframework.org/examples.html#example3) with the PopulationSizeCollector
, attempting to access:
accumulator.get("Population Size", i))
throws an error for undefined key, but only when using certain algorithms (MOEAD and OMOPSO). For other algorithms (NSGAII, GDE3) it works fine. Not sure why this would be the case, since the setup seems to be the same.
I'll paste the full main below for an example of where it happens. Thanks!!
```
Instrumenter instrumenter = new Instrumenter()
.withProblem("UF1")
.withFrequency(1000)
.attachElapsedTimeCollector()
.attachPopulationSizeCollector();
// use the executor to run the algorithm with the instrumenter new Executor() .withProblem("UF1") .withAlgorithm("MOEAD") .withMaxEvaluations(10000) .withInstrumenter(instrumenter) .run(); Accumulator accumulator = instrumenter.getLastAccumulator(); // print the runtime dynamics System.out.format(" NFE Time Popsize%n"); for (int i=0; i<accumulator.size("NFE"); i++) { System.out.format("%5d %-8.4f %5d%n", accumulator.get("NFE", i), accumulator.get("Elapsed Time", i), accumulator.get("Population Size", i)); }
The way it's designed currently, the "Population Size" field is only available for algorithms extending the EvolutionaryAlgorithm interface.
This means that MOEA/D and all of the JMetal algorithms (see http://www.moeaframework.org/javadoc/overview-summary.html#listOfAlgorithms) do not provide this field.
This is unfortunately a limitation of using a third-party library since the algorithms are black boxes. None of the internal fields like population size are exposed.
(For most algorithms, the population size is fixed. See the StandardAlgorithms.java and JMetalAlgorithms.java source code files to see what default values are used.)