?? paes_main.java
字號:
/*
* Main.java
*
* @author Juanjo Durillo
* @version 1.0
*/
package jmetal.metaheuristics.paes;
import jmetal.base.* ;
import jmetal.base.operator.mutation.* ;
import jmetal.problems.* ;
import jmetal.problems.DTLZ.*;
import jmetal.problems.ZDT.*;
import jmetal.problems.WFG.*;
import jmetal.util.JMException;
public class PAES_main {
/**
* @param args Command line arguments. The first (optional) argument specifies
* the problem to solve.
* @throws JMException
*/
public static void main(String [] args) throws JMException {
Problem problem ; // The problem to solve
Algorithm algorithm ; // The algorithm to use
Operator crossover ; // Crossover operator
Operator mutation ; // Mutation operator
Operator selection ; // Selection operator
if (args.length == 1) {
Object [] params = {"Real"};
problem = (new ProblemFactory()).getProblem(args[0],params);
} // if
else { // Default problem
problem = new Kursawe(3, "Real");
//problem = new Kursawe(3,"BinaryReal");
//problem = new Water("Real");
//problem = new ZDT4("Real");
//problem = new WFG1("Real");
//problem = new DTLZ1("Real");
//problem = new OKA2("Real") ;
} // else
algorithm = new PAES(problem);
// Algorithm params
algorithm.setInputParameter("archiveSize",100);
algorithm.setInputParameter("bisections",5);
algorithm.setInputParameter("maxEvaluations",25000);
// Mutation (Real variables)
mutation = MutationFactory.getMutationOperator("PolynomialMutation");
mutation.setParameter("probability",1.0/problem.getNumberOfVariables());
mutation.setParameter("distributionIndex",20.0);
// Mutation (BinaryReal variables)
//mutation = MutationFactory.getMutationOperator("BitFlipMutation");
//mutation.setParameter("probability",1.0/80);
// Add the operators to the algorithm
algorithm.addOperator("mutation", mutation);
// 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
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -