Generic optimization utilities#

pygmo.sbx_crossover(parent1, parent2, bounds, nix, p_cr, eta_c, seed)#

This function will perform a binary crossover on the continuous parts of the two chromosomes parent1 and parent2 and a two-point crossover on their integer parts. The crossover will only happen with a probability p_cr. If that is the case, each continuous component of the chromosomes will be crossovered with a probability of 0.5.

Parameters
  • parent1 (array-like object) – a first chromosome

  • parent2 (array-like object) – a second chromosome

  • bounds (2-D array-like object) – problem bounds

  • nix (int) – the integer dimension of the chromosome

  • p_cr (float) – crossover probability

  • eta_c (float) – crossover distribution index

  • seed (int) – seed used by the internal random number generator

Returns

of numpy.ndarray: containing the two crossovered chromosomes

Return type

tuple

Raises
  • ValueError – if bounds parent1 parent2 are not of equal length, if lower bounds are not less or equal to the upper bounds, if the nix is larger than the parent size or if infinite values are detected in bounds, p_cr or eta_c

  • unspecified – any exception thrown by failiures at the intersection between C++ and Python (e.g., type conversion errors, mismatched function signatures, etc.)

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


pygmo.polynomial_mutation(dv, bounds, nix, p_m, eta_m, seed)#

This function will perform a polynomial mutation over the continuous part of the chromosme dv and a uniform mutation on the remaining integer part.

Parameters
  • dv (array-like object) – the chromosome

  • bounds (2-D array-like object) – problem bounds

  • nix (int) – the integer dimension of the chromosome

  • p_m (float) – mutation probability

  • eta_m (float) – mutation distribution index

  • seed (int) – seed used by the internal random number generator

Returns

of numpy.ndarray: containing the two crossovered chromosomes

Return type

tuple

Raises
  • ValueError – if bounds and dv are not of equal length, if lower bounds are not less or equal to the upper bounds, if the nix is larger than the parent size or if infinite values are detected in bounds, p_m or eta_m

  • unspecified – any exception thrown by failiures at the intersection between C++ and Python (e.g., type conversion errors, mismatched function signatures, etc.)

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