Additional information on MOEAframework Setup Guide

In order to calculate the performance metrics of the algorithms you need to use the Instrumenter class as explained in the Setup Guide. Moreover, to output the metric values you use the Accumulator class.

In order to use compile the new Java file with these new instruments, you need to include the corresponding classes by adding the following lines to the beginning of your .java file:

import java.io.File;

import org.moeaframework.Instrumenter;

import org.moeaframework.analysis.collector.Accumulator;

In order to connect an external problem and reference it as “myProblem” (see Section 5.2 of MOEAFramework manual), the easiest way is to use the global.properties file: it is only necessary to create (or modify) a file called global.properties and save it in your current directory. Only two lines have to be written:

org.moeaframework.problem.problems = myProblem

org.moeaframework.problem.myProblem.class = myProblem

 

Advertisements

3 thoughts on “Additional information on MOEAframework Setup Guide

  1. Can you help me?I encountered a problem. Error occurs when I run a sample program (Page 27, MOEA Framework User Manual Version). The error message is: The source attachment does not contain the source for the file Executor.class…… The sample program is as follows:
    import java.io.IOException;
    import java.io.File;
    import org.moeaframework.Executor;
    import org.moeaframework.Instrumenter;
    import org.moeaframework.analysis.collector.Accumulator;
    public class myTest2 {
    public static void main(String[] args) throws IOException
    {
    Instrumenter instrumenter = new Instrumenter()
    .withProblem(“UF1”)
    .withFrequency(100)
    .attachElapsedTimeCollector()
    .attachGenerationalDistanceCollector();
    new Executor()
    .withProblem(“UF1”)
    .withAlgorithm(“NSGAII”)
    .withMaxEvaluations(10000)
    .withInstrumenter(instrumenter)
    .run();
    Accumulator accumulator = instrumenter.getLastAccumulator();

    for (int i=0; i<accumulator.size("NFE"); i++) {
    System.out.println(accumulator.get("NFE", i) + "\t" +
    accumulator.get("Elapsed Time", i) + "\t" +
    accumulator.get("GenerationalDistance", i));
    }
    }
    }

  2. Pingback: Water Programming Blog Guide (Part I) – Water Programming: A Collaborative Research Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s