/**
   * Configure the MOCell algorithm with default parameter settings
   *
   * @return an algorithm object
   * @throws jmetal.util.JMException
   */
  public Algorithm configure() throws JMException {
    Algorithm algorithm;
    Operator selection = null; // Selection operator
    Operator crossover = null; // Crossover operator
    Operator mutation = null; // Mutation operator
    Operator localsearch = null; // LocalSearch operator

    QualityIndicator indicators;

    // Creating the problem: there are six MOCell variants
    // algorithm = new sMOCell1(problem_) ;
    // algorithm = new sMOCell2(problem_) ;
    // algorithm = new aMOCell1(problem_) ;
    // algorithm = new aMOCell2(problem_) ;
    // algorithm = new aMOCell3(problem_) ;
    // algorithm = new aMOCell4CTBT(problem_) ;
    algorithm = new aMOCell4(problem_);
    //    algorithm = new aMOCell2CTBT(problem_) ;

    // Algorithm parameters
    algorithm.setInputParameter("populationSize", populationSize_);
    algorithm.setInputParameter("maxEvaluations", maxEvaluations_);
    algorithm.setInputParameter("archiveSize", archiveSize_);
    algorithm.setInputParameter("feedBack", feedback_);

    //	algorithm.setInputParameter( "specialSolution"  , P_SPECIAL_SOLUTION );

    // Mutation and Crossover for Real codification
    crossover = CrossoverFactory.getCrossoverOperator(CROSSOVER);
    // crossover = CrossoverFactory.getCrossoverOperator("SBXCrossover");
    crossover.setParameter("probability", crossoverProbability_);
    crossover.setParameter("distributionIndex", distributionIndexForCrossover_);

    mutation = MutationFactory.getMutationOperator(MUTATION);
    // mutation = MutationFactory.getMutationOperator("PolynomialMutation");
    mutation.setParameter("probability", mutationProbability_);
    //    mutation.setParameter( "rounds"             , (Integer) M_ROUNDS );
    mutation.setParameter("Problem", problem_);
    //	mutation.setParameter( "overloadPercentage" , M_OVERLOAD_PER     );
    //	mutation.setParameter( "Policy"             , M_POLICY           );
    //	mutation.setParameter( "Mode"               , M_MODE             );

    selection = SelectionFactory.getSelectionOperator(SELECTION);

    localsearch = LocalSearchFactory.getLocalSearchOperator(LOCAL_SEARCH);
    localsearch.setParameter("Problem", problem_);

    // Add the operators to the algorithm
    algorithm.addOperator("localsearch", localsearch);
    algorithm.addOperator("crossover", crossover);
    algorithm.addOperator("mutation", mutation);
    algorithm.addOperator("selection", selection);

    //   // Creating the indicator object
    //   if (! paretoFrontFile_.equals("")) {
    //      indicators = new QualityIndicator(problem_, paretoFrontFile_);
    //      algorithm.setInputParameter("indicators", indicators) ;
    //   } // if
    return algorithm;
  }
  /**
   * Configure the MOCell algorithm with default parameter settings
   *
   * @return an algorithm object
   * @throws jmetal.util.JMException
   */
  public Algorithm configure() throws JMException {
    Algorithm algorithm;
    Operator selection;
    Operator crossover;
    Operator mutation;

    QualityIndicator indicators;

    // Creating the problem: there are six MOCell variants
    // algorithm = new sMOCell1(problem_) ;
    // algorithm = new sMOCell2(problem_) ;
    // algorithm = new aMOCell1(problem_) ;
    // algorithm = new aMOCell2(problem_) ;
    // algorithm = new aMOCell3(problem_) ;
    algorithm = new sMOCell4CTBT(problem_);

    // Algorithm parameters
    algorithm.setInputParameter("populationSize", populationSize_);
    algorithm.setInputParameter("maxEvaluations", maxEvaluations_);
    algorithm.setInputParameter("archiveSize", archiveSize_);
    algorithm.setInputParameter("feedBack", feedback_);

    // Mutation and Crossover for Real codification
    crossover = CrossoverFactory.getCrossoverOperator("DPX");
    // crossover = CrossoverFactory.getCrossoverOperator("SBXCrossover");
    crossover.setParameter("probability", crossoverProbability_);
    crossover.setParameter("distributionIndex", distributionIndexForCrossover_);

    mutation = MutationFactory.getMutationOperator("BinaryMutation");
    // mutation = MutationFactory.getMutationOperator("PolynomialMutation");
    mutation.setParameter("probability", mutationProbability_);
    mutation.setParameter("distributionIndex", distributionIndexForMutation_);

    // Selection Operator
    selection = SelectionFactory.getSelectionOperator("BinaryTournament");

    // Add the operators to the algorithm
    algorithm.addOperator("crossover", crossover);
    algorithm.addOperator("mutation", mutation);
    algorithm.addOperator("selection", selection);

    //   // Creating the indicator object
    //   if (! paretoFrontFile_.equals("")) {
    //      indicators = new QualityIndicator(problem_, paretoFrontFile_);
    //      algorithm.setInputParameter("indicators", indicators) ;
    //   } // if
    return algorithm;
  }
示例#3
0
  public static void main(String[] args) throws JMException, ClassNotFoundException {
    Problem problem; // The problem to solve
    Algorithm algorithm; // The algorithm to use
    Operator crossover; // Crossover operator
    Operator mutation; // Mutation operator
    Operator selection; // Selection operator

    // int bits ; // Length of bit string in the OneMax problem

    // bits = 512 ;
    // problem = new OneMax(bits);

    problem = new Sphere("Real", 20);
    // problem = new Easom("Real") ;
    // problem = new Griewank("Real", 10) ;

    algorithm = new DE(problem); // Asynchronous cGA

    /* Algorithm parameters*/
    algorithm.setInputParameter("populationSize", 100);
    algorithm.setInputParameter("maxEvaluations", 1000000);

    // Crossover operator
    crossover = CrossoverFactory.getCrossoverOperator("DifferentialEvolutionCrossover");
    crossover.setParameter("CR", 0.1);
    crossover.setParameter("F", 0.5);
    crossover.setParameter("DE_VARIANT", "rand/1/bin");

    // Add the operators to the algorithm
    selection = SelectionFactory.getSelectionOperator("DifferentialEvolutionSelection");

    algorithm.addOperator("crossover", crossover);
    algorithm.addOperator("selection", selection);

    /* Execute the Algorithm */
    long initTime = System.currentTimeMillis();
    SolutionSet population = algorithm.execute();
    long estimatedTime = System.currentTimeMillis() - initTime;
    System.out.println("Total execution time: " + estimatedTime);

    /* Log messages */
    System.out.println("Objectives values have been writen to file FUN");
    population.printObjectivesToFile("FUN");
    System.out.println("Variables values have been writen to file VAR");
    population.printVariablesToFile("VAR");
  } // main