public static void main(String[] args) throws Exception {
    BinaryProblem problem;
    Algorithm<List<BinarySolution>> algorithm;
    CrossoverOperator<BinarySolution> crossover;
    MutationOperator<BinarySolution> mutation;
    SelectionOperator<List<BinarySolution>, BinarySolution> selection;

    String problemName ;
    String referenceParetoFront = "" ;
    if (args.length == 1) {
      problemName = args[0];
    } else if (args.length == 2) {
      problemName = args[0] ;
      referenceParetoFront = args[1] ;
    } else {
      problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT5";
      referenceParetoFront = "" ;
    }

    problem = (BinaryProblem) ProblemUtils.<BinarySolution> loadProblem(problemName);

    double crossoverProbability = 0.9 ;
    crossover = new SinglePointCrossover(crossoverProbability) ;

    double mutationProbability = 1.0 / problem.getNumberOfBits(0) ;
    mutation = new BitFlipMutation(mutationProbability) ;

    selection = new BinaryTournamentSelection<BinarySolution>() ;

    int populationSize = 100;
    algorithm = new NSGAIIBuilder<BinarySolution>(problem, crossover, mutation, populationSize)
            .setSelectionOperator(selection)
            .setMaxEvaluations(25000)
            .build() ;

    AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
            .execute() ;

    List<BinarySolution> population = algorithm.getResult() ;
    long computingTime = algorithmRunner.getComputingTime() ;

    JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");

    printFinalSolutionSet(population);
    if (!referenceParetoFront.equals("")) {
      printQualityIndicators(population, referenceParetoFront) ;
    }
  }
public static void main ( String [ ] args ) throws Exception { BinaryProblem problem ; Algorithm < List < BinarySolution > > algorithm ; CrossoverOperator < BinarySolution > crossover ; MutationOperator < BinarySolution > mutation ; SelectionOperator < List < BinarySolution > , BinarySolution > selection ; String problemName ; String referenceParetoFront = "" ; if ( args . length == 1 ) { problemName = args [ 0 ] ; } else if ( args . length == 2 ) { problemName = args [ 0 ] ; referenceParetoFront = args [ 1 ] ; } else { problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT5" ; referenceParetoFront = "" ; } problem = ( BinaryProblem ) ProblemUtils . < BinarySolution > loadProblem ( problemName ) ; double crossoverProbability = 0.9 ; crossover = new SinglePointCrossover ( crossoverProbability ) ; double mutationProbability = 1.0 / problem . getNumberOfBits ( 0 ) ; mutation = new BitFlipMutation ( mutationProbability ) ; selection = new BinaryTournamentSelection < BinarySolution > ( ) ; int populationSize = 100 ; algorithm = new NSGAIIBuilder < BinarySolution > ( problem , crossover , mutation , populationSize ) . setSelectionOperator ( selection ) . setMaxEvaluations ( 25000 ) . build ( ) ; AlgorithmRunner algorithmRunner = new AlgorithmRunner . Executor ( algorithm ) . execute ( ) ; List < BinarySolution > population = algorithm . getResult ( ) ; long computingTime = algorithmRunner . getComputingTime ( ) ; JMetalLogger . logger . info ( "Total execution time: " + computingTime + "ms" ) ; printFinalSolutionSet ( population ) ; if ( ! referenceParetoFront . equals ( "" ) ) { printQualityIndicators ( population , referenceParetoFront ) ; } }
@param args Command line arguments.
@throws org.uma.jmetal.util.JMetalException
@throws java.io.IOException
@throws SecurityException
@throws ClassNotFoundException
Invoking command:
java org.uma.jmetal.runner.multiobjective.NSGAIIBinaryRunner problemName [referenceFront]