本文整理汇总了Java中org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection类的典型用法代码示例。如果您正苦于以下问题:Java BinaryTournamentSelection类的具体用法?Java BinaryTournamentSelection怎么用?Java BinaryTournamentSelection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BinaryTournamentSelection类属于org.uma.jmetal.operator.impl.selection包,在下文中一共展示了BinaryTournamentSelection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 ;
}
示例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 ;
}
示例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>();
}
示例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)) ;
}
示例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)) ;
}
示例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 ;
}
示例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 ;
}
示例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) ;
}
示例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>();
}
示例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 ;
}
示例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 ;
}
示例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)) ;
}
示例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");
}
示例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)) ;
}
示例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);
}
}