GP Algorithms

harm(toolbox, population, generations, cx_prob, mut_prob, alpha=0.05, beta=10.0, gamma=0.25, rho=0.9, nb_model=-1, min_cutoff=20, hof=None, stats=None, verbose=False)

Implements population bloat control by an evolution algorithm for a genetic program. The default parameter values are recommended for most use-cases.

Parameters
  • toolbox (Toolbox) – A Toolbox which contains the evolution operators.

  • population (list) – A list of individuals to evolve.

  • generations (int) – The number of generations to compute.

  • cx_prob (float) – The probability of mating two individuals.

  • mut_prob (float) – The probability of mutating an individual.

  • alpha (float) – The half-life of the exponential, which is linearly proportional to the cutoff point, optional. Higher values increase the chance of accepting larger individuals.

  • beta (float) – The minimal value of the half-life, which ensures that reasonably sized growth is always possible even during the first few generations, when sizes can be small, optional.

  • gamma (float) – The percentage of individuals that are allowed after the cutoff point, optional. Sets the proportion of the population that is allowed to grow in size.

  • rho (float) – Controls the position of the cutoff point by setting the range of fitness in which to search for the smallest individual, optional. Higher values of ‘rho’ can be used to search more aggressively for slightly better solutions with the potential downside of increasing the risk of over-fitting.

  • nb_model (int) – The number of individuals to generate in order to model the natural distribution, optional. The default value of -1 sets the ‘nb_model’ to max(2000, len(population)).

  • min_cutoff (int) – The absolute minimum value for the cutoff point, optional. It ensures that the algorithm does not shrink the population too much at the beginning of the evolution.

  • hof (Hof) – A HallOfFame or a ParetoFront object, optional.

  • stats (Stats) – A Statistics or a MultiStatistics object, optional.

  • verbose (bool) – Whether to print debug messages, optional.

Returns

The final population and the logbook.

Return type

AlgoResult