本文整理汇总了Java中org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection类的典型用法代码示例。如果您正苦于以下问题:Java BinaryTournamentSelection类的具体用法?Java BinaryTournamentSelection怎么用?Java BinaryTournamentSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BinaryTournamentSelection类属于org.uma.jmetal.operator.impl.selection包,在下文中一共展示了BinaryTournamentSelection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: InDM2Builder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
public InDM2Builder(CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator,
List<Double> referencePoint,
Observable<AlgorithmObservedData<S>> observable) {
this.crossover = crossoverOperator;
this.mutation = mutationOperator;
this.selection = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>());
this.evaluator = new SequentialSolutionListEvaluator<S>();
this.crossoverProbability = 0.9;
this.crossoverDistributionIndex = 20.0;
this.mutationDistributionIndex = 20.0;
this.maxIterations = 25000;
this.populationSize = 100;
this.observable = observable;
this.referencePoint = new ArrayList<>();
this.referencePoint = referencePoint ;
}
开发者ID:jMetal,项目名称:jMetalSP,代码行数:18,代码来源:InDM2Builder.java
示例2: DynamicWASFGABuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
public DynamicWASFGABuilder(CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator,
List<Double> referencePoint,
Observable<AlgorithmObservedData<S>> observable) {
this.crossover = crossoverOperator;
this.mutation = mutationOperator;
this.selection = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>());
this.evaluator = new SequentialSolutionListEvaluator<S>();
this.crossoverProbability = 0.9;
this.crossoverDistributionIndex = 20.0;
this.mutationDistributionIndex = 20.0;
this.maxIterations = 25000;
this.populationSize = 100;
this.observable = observable;
this.referencePoint = referencePoint ;
}
开发者ID:jMetal,项目名称:jMetalSP,代码行数:17,代码来源:DynamicWASFGABuilder.java
示例3: IBEABuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* Constructor
* @param problem
*/
public IBEABuilder(Problem<DoubleSolution> problem) {
this.problem = problem;
populationSize = 100;
archiveSize = 100;
maxEvaluations = 25000;
double crossoverProbability = 0.9;
double crossoverDistributionIndex = 20.0;
crossover = new SBXCrossover(crossoverProbability, crossoverDistributionIndex);
double mutationProbability = 1.0 / problem.getNumberOfVariables();
double mutationDistributionIndex = 20.0;
mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex);
selection = new BinaryTournamentSelection<DoubleSolution>();
}
开发者ID:jMetal,项目名称:jMetal,代码行数:21,代码来源:IBEABuilder.java
示例4: shouldTheAlgorithmReturnTheCorrectSolutionWhenSolvingProblemOneMax
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
@Test
public void shouldTheAlgorithmReturnTheCorrectSolutionWhenSolvingProblemOneMax() {
int NUMBER_OF_BITS = 512 ;
Algorithm<BinarySolution> algorithm;
BinaryProblem problem = new OneMax(NUMBER_OF_BITS) ;
CrossoverOperator<BinarySolution> crossoverOperator = new SinglePointCrossover(0.9) ;
MutationOperator<BinarySolution> mutationOperator = new BitFlipMutation(1.0 / problem.getNumberOfBits(0)) ;
SelectionOperator<List<BinarySolution>, BinarySolution> selectionOperator = new BinaryTournamentSelection<BinarySolution>();
algorithm = new GeneticAlgorithmBuilder<BinarySolution>(problem, crossoverOperator, mutationOperator)
.setVariant(GeneticAlgorithmBuilder.GeneticAlgorithmVariant.STEADY_STATE)
.setPopulationSize(50)
.setMaxEvaluations(25000)
.setSelectionOperator(selectionOperator)
.build() ;
new AlgorithmRunner.Executor(algorithm).execute() ;
BinarySolution solution = algorithm.getResult() ;
assertEquals(NUMBER_OF_BITS, -1 * (int)solution.getObjective(0)) ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:23,代码来源:SteadyStateGeneticAlgorithmTestIT.java
示例5: shouldTheAlgorithmReturnTheCorrectSolutionWhenSolvingProblemOneMax
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
@Test
public void shouldTheAlgorithmReturnTheCorrectSolutionWhenSolvingProblemOneMax() {
int NUMBER_OF_BITS = 512 ;
Algorithm<BinarySolution> algorithm;
BinaryProblem problem = new OneMax(NUMBER_OF_BITS) ;
CrossoverOperator<BinarySolution> crossoverOperator = new SinglePointCrossover(0.9) ;
MutationOperator<BinarySolution> mutationOperator = new BitFlipMutation(1.0 / problem.getNumberOfBits(0)) ;
SelectionOperator<List<BinarySolution>, BinarySolution> selectionOperator = new BinaryTournamentSelection<BinarySolution>();
algorithm = new GeneticAlgorithmBuilder<BinarySolution>(problem, crossoverOperator, mutationOperator)
.setPopulationSize(50)
.setMaxEvaluations(50000)
.setSelectionOperator(selectionOperator)
.build() ;
new AlgorithmRunner.Executor(algorithm).execute() ;
BinarySolution solution = algorithm.getResult() ;
assertEquals(NUMBER_OF_BITS, -1 * (int)solution.getObjective(0)) ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:22,代码来源:GenerationalGeneticAlgorithmTestIT.java
示例6: DynamicMOCellBuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
public DynamicMOCellBuilder(CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator,
Observable<AlgorithmObservedData<S>> observable) {
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator;
this.maxEvaluations = 25000 ;
this.populationSize = 100 ;
this.selectionOperator = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>()) ;
neighborhood = new C9<S>((int)Math.sqrt(populationSize), (int)Math.sqrt(populationSize)) ;
evaluator = new SequentialSolutionListEvaluator<S>();
archive = new CrowdingDistanceArchive<>(populationSize) ;
this.observable = observable ;
}
开发者ID:jMetal,项目名称:jMetalSP,代码行数:14,代码来源:DynamicMOCellBuilder.java
示例7: DynamicNSGAIIBuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
public DynamicNSGAIIBuilder(CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator,
Observable<AlgorithmObservedData<S>> observable) {
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator;
this.maxEvaluations = 25000 ;
this.populationSize = 100 ;
this.selectionOperator = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>()) ;
this.evaluator = new SequentialSolutionListEvaluator<S>();
this.observable = observable ;
}
开发者ID:jMetal,项目名称:jMetalSP,代码行数:12,代码来源:DynamicNSGAIIBuilder.java
示例8: MOCellBuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* MOCellBuilder constructor
*/
public MOCellBuilder(Problem<S> problem, CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator) {
this.problem = problem;
maxEvaluations = 25000;
populationSize = 100;
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator ;
selectionOperator = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>());
neighborhood = new C9<S>((int)Math.sqrt(populationSize), (int)Math.sqrt(populationSize)) ;
evaluator = new SequentialSolutionListEvaluator<S>();
archive = new CrowdingDistanceArchive<>(populationSize) ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:16,代码来源:MOCellBuilder.java
示例9: SPEA2Builder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* SPEA2Builder constructor
*/
public SPEA2Builder(Problem<S> problem, CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator) {
this.problem = problem;
maxIterations = 250;
populationSize = 100;
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator ;
selectionOperator = new BinaryTournamentSelection<S>();
evaluator = new SequentialSolutionListEvaluator<S>();
}
开发者ID:jMetal,项目名称:jMetal,代码行数:14,代码来源:SPEA2Builder.java
示例10: NSGAIIBuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* NSGAIIBuilder constructor
*/
public NSGAIIBuilder(Problem<S> problem, CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator) {
this.problem = problem;
maxEvaluations = 25000;
populationSize = 100;
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator ;
selectionOperator = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>()) ;
evaluator = new SequentialSolutionListEvaluator<S>();
dominanceComparator = new DominanceComparator<>() ;
this.variant = NSGAIIVariant.NSGAII ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:17,代码来源:NSGAIIBuilder.java
示例11: RNSGAIIBuilder
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* NSGAIIBuilder constructor
*/
public RNSGAIIBuilder(Problem<S> problem, CrossoverOperator<S> crossoverOperator,
MutationOperator<S> mutationOperator, List<Double> interestPoint, double epsilon) {
this.problem = problem;
maxEvaluations = 25000;
populationSize = 100;
this.crossoverOperator = crossoverOperator ;
this.mutationOperator = mutationOperator ;
selectionOperator = new BinaryTournamentSelection<S>(new RankingAndCrowdingDistanceComparator<S>()) ;
evaluator = new SequentialSolutionListEvaluator<S>();
this.epsilon = epsilon;
this.interestPoint = interestPoint;
this.variant = NSGAIIVariant.NSGAII ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:17,代码来源:RNSGAIIBuilder.java
示例12: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* Usage: java org.uma.jmetal.runner.singleobjective.SteadyStateGeneticAlgorithmRunner
*/
public static void main(String[] args) throws Exception {
Algorithm<DoubleSolution> algorithm;
DoubleProblem problem = new Sphere(20) ;
CrossoverOperator<DoubleSolution> crossoverOperator =
new SBXCrossover(0.9, 20.0) ;
MutationOperator<DoubleSolution> mutationOperator =
new PolynomialMutation(1.0 / problem.getNumberOfVariables(), 20.0) ;
SelectionOperator<List<DoubleSolution>, DoubleSolution> selectionOperator = new BinaryTournamentSelection<DoubleSolution>() ;
algorithm = new GeneticAlgorithmBuilder<DoubleSolution>(problem, crossoverOperator, mutationOperator)
.setPopulationSize(100)
.setMaxEvaluations(25000)
.setSelectionOperator(selectionOperator)
.setVariant(GeneticAlgorithmBuilder.GeneticAlgorithmVariant.STEADY_STATE)
.build() ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
long computingTime = algorithmRunner.getComputingTime() ;
DoubleSolution solution = algorithm.getResult() ;
List<DoubleSolution> population = new ArrayList<>(1) ;
population.add(solution) ;
new SolutionListOutput(population)
.setSeparator("\t")
.setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv"))
.setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv"))
.print();
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
JMetalLogger.logger.info("Objectives values have been written to file FUN.tsv");
JMetalLogger.logger.info("Variables values have been written to file VAR.tsv");
JMetalLogger.logger.info("Fitness: " + solution.getObjective(0)) ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:42,代码来源:SteadyStateGeneticAlgorithmRunner.java
示例13: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* Usage: java
* org.uma.jmetal.runner.singleobjective.CoralReefsOptimizationRunner
*/
public static void main(String[] args) throws Exception {
Algorithm<List<BinarySolution>> algorithm;
BinaryProblem problem = new OneMax(512);
CrossoverOperator<BinarySolution> crossoverOperator = new SinglePointCrossover(
0.9);
MutationOperator<BinarySolution> mutationOperator = new BitFlipMutation(
1.0 / problem.getNumberOfBits(0));
SelectionOperator<List<BinarySolution>, BinarySolution> selectionOperator = new BinaryTournamentSelection<BinarySolution>();
algorithm = new CoralReefsOptimizationBuilder<BinarySolution>(problem,
selectionOperator, crossoverOperator, mutationOperator)
.setM(10).setN(10).setRho(0.6).setFbs(0.9).setFbr(0.1)
.setFa(0.1).setPd(0.1).setAttemptsToSettle(3)
.setComparator(new ObjectiveComparator<BinarySolution>(0))
.build();
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(
algorithm).execute();
List<BinarySolution> population = algorithm.getResult();
long computingTime = algorithmRunner.getComputingTime();
new SolutionListOutput(population)
.setSeparator("\t")
.setVarFileOutputContext(
new DefaultFileOutputContext("VAR.tsv"))
.setFunFileOutputContext(
new DefaultFileOutputContext("FUN.tsv")).print();
JMetalLogger.logger.info("Total execution time: " + computingTime
+ "ms");
JMetalLogger.logger
.info("Objectives values have been written to file FUN.tsv");
JMetalLogger.logger
.info("Variables values have been written to file VAR.tsv");
}
开发者ID:jMetal,项目名称:jMetal,代码行数:44,代码来源:CoralReefsOptimizationRunner.java
示例14: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* Usage: java org.uma.jmetal.runner.singleobjective.GenerationalGeneticAlgorithmDoubleEncodingRunner
*/
public static void main(String[] args) throws Exception {
Algorithm<DoubleSolution> algorithm;
DoubleProblem problem = new Sphere(20) ;
CrossoverOperator<DoubleSolution> crossover =
new SBXCrossover(0.9, 20.0) ;
MutationOperator<DoubleSolution> mutation =
new PolynomialMutation(1.0 / problem.getNumberOfVariables(), 20.0) ;
SelectionOperator<List<DoubleSolution>, DoubleSolution> selection = new BinaryTournamentSelection<DoubleSolution>() ;
algorithm = new GeneticAlgorithmBuilder<>(problem, crossover, mutation)
.setPopulationSize(100)
.setMaxEvaluations(25000)
.setSelectionOperator(selection)
.build() ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
DoubleSolution solution = algorithm.getResult() ;
List<DoubleSolution> population = new ArrayList<>(1) ;
population.add(solution) ;
long computingTime = algorithmRunner.getComputingTime() ;
new SolutionListOutput(population)
.setSeparator("\t")
.setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv"))
.setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv"))
.print();
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
JMetalLogger.logger.info("Objectives values have been written to file FUN.tsv");
JMetalLogger.logger.info("Variables values have been written to file VAR.tsv");
JMetalLogger.logger.info("Fitness: " + solution.getObjective(0)) ;
}
开发者ID:jMetal,项目名称:jMetal,代码行数:41,代码来源:GenerationalGeneticAlgorithmDoubleEncodingRunner.java
示例15: createAlgorithm
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
private Algorithm<List<PlanningSolution>> createAlgorithm(AlgorithmType algorithmType, NextReleaseProblem problem) {
CrossoverOperator<PlanningSolution> crossover;
MutationOperator<PlanningSolution> mutation;
SelectionOperator<List<PlanningSolution>, PlanningSolution> selection;
crossover = new PlanningCrossoverOperator(problem);
mutation = new PlanningMutationOperator(problem);
selection = new BinaryTournamentSelection<>(new PlanningSolutionDominanceComparator());
AlgorithmParameters parameters = problem.getAlgorithmParameters();
int nbIterations = parameters.getNumberOfIterations();
int populationSize = parameters.getPopulationSize();
switch (algorithmType) {
case NSGAII:
return new NSGAIIBuilder<>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxIterations(nbIterations)
.setPopulationSize(populationSize)
.build();
case MOCell:
return new MOCellBuilder<>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxEvaluations(nbIterations)
.setPopulationSize(populationSize) // sqrt(populationSize) tiene que ser entero
.setNeighborhood(new C9<>((int) Math.sqrt(2500), (int) Math.sqrt(2500)))
.build();
case SPEA2:
return new SPEA2Builder<>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxIterations(nbIterations)
.setPopulationSize(populationSize)
.build();
case PESA2:
return new PESA2Builder<>(problem, crossover, mutation)
.setMaxEvaluations(nbIterations)
.setPopulationSize(populationSize)
.build();
case SMSEMOA:
return new SMSEMOABuilder<>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxEvaluations(nbIterations)
.setPopulationSize(populationSize)
.build();
default:
return createAlgorithm(AlgorithmType.MOCell, problem);
}
}
开发者ID:supersede-project,项目名称:replan_optimizer_v2,代码行数:49,代码来源:SolverNRP.java
示例16: getAlgorithm
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
public static DynamicAlgorithm<List<DoubleSolution>, AlgorithmObservedData<DoubleSolution>>
getAlgorithm(String algorithmName, DynamicProblem<DoubleSolution, SingleObservedData<Integer>> problem) {
DynamicAlgorithm<List<DoubleSolution>, AlgorithmObservedData<DoubleSolution>> algorithm;
CrossoverOperator<DoubleSolution> crossover = new SBXCrossover(0.9, 20.0);
MutationOperator<DoubleSolution> mutation =
new PolynomialMutation(1.0 / problem.getNumberOfVariables(), 20.0);
SelectionOperator<List<DoubleSolution>, DoubleSolution> selection=new BinaryTournamentSelection<DoubleSolution>();;
switch (algorithmName) {
case "NSGAII":
algorithm = new DynamicNSGAIIBuilder<>(crossover, mutation, new DefaultObservable<>())
.setMaxEvaluations(50000)
.setPopulationSize(100)
.build(problem);
break;
case "MOCell":
algorithm = new DynamicMOCellBuilder<>(crossover, mutation, new DefaultObservable<>())
.setMaxEvaluations(50000)
.setPopulationSize(100)
.build(problem);
break;
case "SMPSO":
algorithm = new DynamicSMPSOBuilder<>(
mutation, new CrowdingDistanceArchive<>(100), new DefaultObservable<>())
.setMaxIterations(500)
.setSwarmSize(100)
.build(problem);
break;
case "WASFGA":
List<Double> referencePoint = new ArrayList<>();
referencePoint.add(0.5);
referencePoint.add(0.5);
algorithm = new DynamicWASFGABuilder<>(crossover, mutation, referencePoint, new DefaultObservable<>())
.setMaxIterations(500)
.setPopulationSize(100)
.build(problem);
break;
case "NSGAIII":
algorithm = (DynamicAlgorithm<List<DoubleSolution>, AlgorithmObservedData<DoubleSolution>>) new DynamicNSGAIIIBuilder<>(problem,new DefaultObservable<>())
.setCrossoverOperator(crossover)
.setMutationOperator(mutation)
.setSelectionOperator(selection)
.setMaxIterations(50000)
.build();
break;
default:
throw new JMetalException("Algorithm " + algorithmName + " does not exist") ;
}
return algorithm ;
}
开发者ID:jMetal,项目名称:jMetalSP,代码行数:58,代码来源:AlgorithmFactory.java
示例17: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* @param args Command line arguments.
* @throws JMetalException
* @throws FileNotFoundException
* Invoking command:
java org.uma.jmetal.runner.multiobjective.WASFGABinaryRunner problemName [referenceFront]
*/
public static void main(String[] args) throws JMetalException, IOException {
/*Problem<DoubleSolution> problem;
PermutationProblem<PermutationSolution<Integer>> problem;
Algorithm<List<DoubleSolution>> algorithm;
CrossoverOperator<DoubleSolution> crossover;
MutationOperator<DoubleSolution> mutation;
SelectionOperator<List<DoubleSolution>, DoubleSolution> selection;*/
Algorithm<List<PermutationSolution<Integer>>> algorithm;
PermutationProblem<PermutationSolution<Integer>> problem;
CrossoverOperator<PermutationSolution<Integer>> crossover;
MutationOperator<PermutationSolution<Integer>> mutation;
SelectionOperator<List<PermutationSolution<Integer>>, PermutationSolution<Integer>> selection;
problem = new MultiobjectiveTSP("/tspInstances/kroA100.tsp", "/tspInstances/kroB100.tsp");
crossover = new PMXCrossover(0.9) ;
double mutationProbability = 0.2 ;
mutation = new PermutationSwapMutation<Integer>(mutationProbability) ;
selection = new BinaryTournamentSelection<PermutationSolution<Integer>>(new RankingAndCrowdingDistanceComparator<PermutationSolution<Integer>>());
String referenceParetoFront = "" ;
List<Double> referencePoint = null;
/*String problemName ;
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.ZDT4";
referenceParetoFront = "jmetal-problem/src/test/resources/pareto_fronts/ZDT4.pf" ;
}*/
//problem = ProblemUtils.<DoubleSolution> loadProblem(problemName);
problem = new MultiobjectiveTSP("/tspInstances/kroA100.tsp", "/tspInstances/kroB100.tsp");
referencePoint = new ArrayList<>();
referencePoint.add(0.0);
referencePoint.add(0.0);
/*
double crossoverProbability = 0.9 ;
double crossoverDistributionIndex = 20.0 ;
crossover = new SBXCrossover(crossoverProbability, crossoverDistributionIndex) ;
double mutationProbability = 1.0 / problem.getNumberOfVariables() ;
double mutationDistributionIndex = 20.0 ;
mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex) ;
selection = new BinaryTournamentSelection<DoubleSolution>(new RankingAndCrowdingDistanceComparator<DoubleSolution>());*/
algorithm = new WASFGA<PermutationSolution<Integer>>(problem, 100, 250, crossover, mutation, selection,new SequentialSolutionListEvaluator<PermutationSolution<Integer>>(),referencePoint) ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
List<PermutationSolution<Integer>> population = algorithm.getResult() ;
long computingTime = algorithmRunner.getComputingTime() ;
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
printFinalSolutionSet(population);
if (!referenceParetoFront.equals("")) {
printQualityIndicators(population, referenceParetoFront) ;
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:75,代码来源:WASFGARunner.java
示例18: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* @param args Command line arguments.
* @throws JMetalException
* @throws FileNotFoundException
* Invoking command:
java org.uma.jmetal.runner.multiobjective.MOCellRunner problemName [referenceFront]
*/
public static void main(String[] args) throws JMetalException, FileNotFoundException {
Problem<DoubleSolution> problem;
Algorithm<List<DoubleSolution>> algorithm;
SelectionOperator<List<DoubleSolution>, DoubleSolution> selection;
DifferentialEvolutionCrossover crossover;
String referenceParetoFront = "" ;
String problemName ;
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.dtlz.DTLZ1";
referenceParetoFront = "jmetal-problem/src/test/resources/pareto_fronts/DTLZ1.3D.pf" ;
}
problem = ProblemUtils.<DoubleSolution> loadProblem(problemName);
double cr = 0.5 ;
double f = 0.5 ;
crossover = new DifferentialEvolutionCrossover(cr, f, "rand/1/bin") ;
selection = new BinaryTournamentSelection<DoubleSolution>(new RankingAndCrowdingDistanceComparator<DoubleSolution>());
algorithm = new CellDE45(
problem,
50000,
100,
new CrowdingDistanceArchive<DoubleSolution>(100),
new C9<DoubleSolution>((int)Math.sqrt(100), (int)Math.sqrt(100)),
selection,
crossover,
20,
new SequentialSolutionListEvaluator<DoubleSolution>()
) ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
List<DoubleSolution> population = algorithm.getResult() ;
long computingTime = algorithmRunner.getComputingTime() ;
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
printFinalSolutionSet(population);
if (!referenceParetoFront.equals("")) {
printQualityIndicators(population, referenceParetoFront) ;
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:60,代码来源:CellDERunner.java
示例19: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* @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.NSGAIIIntegerRunner problemName [referenceFront]
*/
public static void main(String[] args) throws FileNotFoundException {
Problem<IntegerSolution> problem;
Algorithm<List<IntegerSolution>> algorithm;
CrossoverOperator<IntegerSolution> crossover;
MutationOperator<IntegerSolution> mutation;
SelectionOperator<List<IntegerSolution>, IntegerSolution> 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.NMMin" ;
referenceParetoFront = "";
}
problem = ProblemUtils.<IntegerSolution> loadProblem(problemName);
double crossoverProbability = 0.9 ;
double crossoverDistributionIndex = 20.0 ;
crossover = new IntegerSBXCrossover(crossoverProbability, crossoverDistributionIndex) ;
double mutationProbability = 1.0 / problem.getNumberOfVariables() ;
double mutationDistributionIndex = 20.0 ;
mutation = new IntegerPolynomialMutation(mutationProbability, mutationDistributionIndex) ;
selection = new BinaryTournamentSelection<IntegerSolution>() ;
algorithm = new NSGAIIBuilder<IntegerSolution>(problem, crossover, mutation)
.setSelectionOperator(selection)
.setMaxEvaluations(25000)
.setPopulationSize(100)
.build() ;
AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm)
.execute() ;
List<IntegerSolution> population = algorithm.getResult() ;
long computingTime = algorithmRunner.getComputingTime() ;
JMetalLogger.logger.info("Total execution time: " + computingTime + "ms");
printFinalSolutionSet(population);
if (!referenceParetoFront.equals("")) {
printQualityIndicators(population, referenceParetoFront) ;
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:61,代码来源:NSGAIIIntegerRunner.java
示例20: main
import org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection; //导入依赖的package包/类
/**
* @param args Command line arguments.
* @throws JMetalException
* @throws FileNotFoundException
* Invoking command:
java org.uma.jmetal.runner.multiobjective.WASFGARunner problemName [referenceFront]
*/
public static void main(String[] args) throws JMetalException, FileNotFoundException {
BinaryProblem problem;
Algorithm<List<BinarySolution>> algorithm;
CrossoverOperator<BinarySolution> crossover;
MutationOperator<BinarySolution> mutation;
SelectionOperator<List<BinarySolution>, BinarySolution> selection;
String referenceParetoFront = "" ;
List<Double> referencePoint = null;
String problemName ;
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";
}
problem = (BinaryProblem) ProblemUtils.<BinarySolution> loadProblem(problemName);
referencePoint = new ArrayList<>();
referencePoint.add(10.0);
referencePoint.add(4.0);
double crossoverProbability = 0.9 ;
crossover = new SinglePointCrossover(crossoverProbability) ;
double mutationProbability = 1.0 / problem.getNumberOfBits(0) ;
mutation = new BitFlipMutation(mutationProbability) ;
selection = new BinaryTournamentSelection<BinarySolution>() ;
algorithm = new WASFGA<BinarySolution>(problem, 100, 250, crossover, mutation, selection,new SequentialSolutionListEvaluator<BinarySolution>(),referencePoint) ;
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) ;
}
}
开发者ID:jMetal,项目名称:jMetal,代码行数:56,代码来源:WASFGABinaryRunner.java
注:本文中的org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论