/* Copyright 2009-2015 David Hadka * * This file is part of the MOEA Framework. * * The MOEA Framework is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * The MOEA Framework is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the MOEA Framework. If not, see <http://www.gnu.org/licenses/>. */ import java.io.IOException; import org.moeaframework.Analyzer; import org.moeaframework.Executor; /** * Demonstrates how only a few lines of code are necessary to setup, run * and statistically compare multiple algorithms. */ public class Example2 { public static void main(String[] args) throws IOException { String problem = "UF1"; String[] algorithms = { "NSGAII", "GDE3", "eMOEA" }; //setup the experiment Executor executor = new Executor() .withProblem(problem) .withMaxEvaluations(10000); Analyzer analyzer = new Analyzer() .withProblem(problem) .includeHypervolume() .showStatisticalSignificance(); //run each algorithm for 50 seeds for (String algorithm : algorithms) { analyzer.addAll(algorithm, executor.withAlgorithm(algorithm).runSeeds(50)); } //print the results analyzer.printAnalysis(); } }