List of replacement policies#

Replacement policies exposed from C++#

class pygmo.fair_replace(rate=1)#

Fair replacement policy.

This user-defined replacement policy (UDRP) will replace individuals in a group only if the candidate replacement individuals are better than the original individuals.

In this context, better means the following:

  • in single-objective unconstrained problems, an individual is better than another one if its fitness is lower,

  • in single-objective constrained problems, individuals are ranked via sort_population_con(),

  • in multi-objective unconstrained problems, individuals are ranked via sort_population_mo().

Note that this user-defined replacement policy currently does not support multi-objective constrained problems.

A fair replacement policy is constructed from a rate argument, which can be either an integral or a floating-point value.

If rate is a floating point value in the \(\left[0,1\right]\) range, then it represents a fractional migration rate. That is, it indicates, the fraction of individuals that may be replaced in the input population: a value of 0 means that no individuals will be replaced, a value of 1 means that all individuals may be replaced.

If rate is an integral value, then it represents an absolute migration rate, that is, the exact number of individuals that may be replaced in the input population.

See also the docs of the C++ class pagmo::fair_replace.


rate (int, float) – the desired migration rate

  • ValueError – if the supplied fractional migration rate is not finite or not in the \(\left[0,1\right]\) range

  • TypeError – if rate is not an instance of int or float

  • unspecified – any exception raised by the invoked C++ constructor