Created
July 27, 2016 12:22
-
-
Save dhadka/d3661b52fe0e81f103a5b4c2aedb20bc to your computer and use it in GitHub Desktop.
RuntimeApproximationSets.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instrumenter instrumenter = new Instrumenter() | |
.withProblem("UF1") | |
.withFrequency(100) | |
.attachApproximationSetCollector(); | |
new Executor() | |
.withProblem("UF1") | |
.withAlgorithm("NSGAII") | |
.withMaxEvaluations(10000) | |
.withInstrumenter(instrumenter) | |
.run(); | |
Accumulator accumulator = instrumenter.getLastAccumulator(); | |
List<Integer> xs = new ArrayList<Integer>(); | |
List<Double> ys = new ArrayList<Double>(); | |
for (int i = 0; i < accumulator.size("NFE"); i++) { | |
// determine the maximum objective value | |
double maxObj = Double.NEGATIVE_INFINITY; | |
for (Solution solution : (List<Solution>)accumulator.get("Approximation Set", i)) { | |
maxObj = Math.max(maxObj, solution.getObjective(0)); | |
} | |
// update the series to plot | |
xs.add((Integer)accumulator.get("NFE", i)); | |
ys.add(maxObj); | |
} | |
new Plot() | |
.line("Objective 1 (Max)", xs, ys) | |
.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment