Пример #1
0
  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
 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;
 }