All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.uma.jmetal.experiment.NSGAIIStudy Maven / Gradle / Ivy

There is a newer version: 5.9
Show newest version
package org.uma.jmetal.experiment;

import org.uma.jmetal.algorithm.Algorithm;
import org.uma.jmetal.algorithm.multiobjective.nsgaii.NSGAIIBuilder;
import org.uma.jmetal.operator.impl.crossover.SBXCrossover;
import org.uma.jmetal.operator.impl.mutation.PolynomialMutation;
import org.uma.jmetal.problem.Problem;
import org.uma.jmetal.problem.multiobjective.zdt.*;
import org.uma.jmetal.solution.DoubleSolution;
import org.uma.jmetal.util.experiment.ExperimentConfiguration;
import org.uma.jmetal.util.experiment.ExperimentConfigurationBuilder;
import org.uma.jmetal.util.experiment.ExperimentalStudy;
import org.uma.jmetal.util.experiment.impl.AlgorithmExecution;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by ajnebro on 22/3/15.
 */
public class NSGAIIStudy  {
  public NSGAIIStudy() {
    List> problemList = Arrays.>asList(new ZDT1(), new ZDT2(),
        new ZDT3(), new ZDT4(), new ZDT6()) ;

    List>> algorithmList = configureAlgorithmList(problemList) ;

    ExperimentConfiguration configuration = new ExperimentConfigurationBuilder("Experiment")
        .setAlgorithmList(algorithmList)
        .setProblemList(problemList)
        .setExperimentBaseDirectory("/Users/antelverde/Softw/jMetal/jMetalGitHub/pruebas")
        .setOutputParetoFrontFileName("FUN")
        .setOutputParetoSetFileName("VAR")
        .setIndependentRuns(4)
        .build();

    AlgorithmExecution algorithmExecution = new AlgorithmExecution(configuration) ;

    ExperimentalStudy study = new ExperimentalStudy.Builder(configuration)
        .addExperiment(algorithmExecution)
        .build() ;

    study.run() ;
  }



  List>> configureAlgorithmList(List> problemList) {
    List>> algorithms = new ArrayList<>() ;
    for (int i = 0 ; i < problemList.size(); i++) {
      algorithms.add(
          new NSGAIIBuilder<>(problemList.get(i), new SBXCrossover(1.0, 20.0),
              new PolynomialMutation(1.0/problemList.get(i).getNumberOfVariables(), 20.0))
              .build()) ;
    }

    return algorithms ;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy