当前位置: 首页>>代码示例>>Java>>正文


Java BinaryTournamentSelection类代码示例

本文整理汇总了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 ;
}
 
开发者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


注:本文中的org.uma.jmetal.operator.impl.selection.BinaryTournamentSelection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。