コード例 #1
0
ファイル: Crossover.java プロジェクト: bburkot/io
  private double getCrossoverRate(IPopulation parents) {
    int population_size = parents.getGenotypes().size();
    if (population_size <= AVG_SIZE) return properties.getCrossoverRate();

    if (population_size >= MAX_SIZE) return 0;

    return properties.getCrossoverRate() * (MAX_SIZE - population_size) / MAX_SIZE;
  }
コード例 #2
0
ファイル: Crossover.java プロジェクト: bburkot/io
 public Crossover(AlgorithmProperties properties, GenotypeHelper helper) {
   this.properties = properties;
   this.helper = helper;
   this.random = properties.getRandom();
   this.MIN_SIZE = properties.getThreadPopulationMinSize();
   this.MAX_SIZE = properties.getThreadPopulationMaxSize();
   this.AVG_SIZE = (MIN_SIZE + MAX_SIZE) / 2;
 }