desdeo_emo.recombination.SinglePointCrossoverMutation

Module Contents

Classes

SinglePoint_Xover

Simple single point crossover and mutation.

SinglePoint_Mutation

Simple single point crossover and mutation.

class desdeo_emo.recombination.SinglePointCrossoverMutation.SinglePoint_Xover(ProC: float = 1, DisC: float = 30)[source]

Simple single point crossover and mutation.

Parameters
ProCfloat, optional

[description], by default 1

DisCfloat, optional

[description], by default 30

crossover(ind_0, ind_1)[source]

Single point crossover. :param ind_0: individual_0 :param ind_1: individual_1

Ret:

new_0, new_1: the individuals generatd after crossover.

mutation(indi)[source]

Simple mutation. Arg:

indi: individual to mutation.

do(pop: numpy.ndarray, mating_pop_ids: list = None) numpy.ndarray[source]
Consecutive members of mating_pop_ids are crossed over

in pairs. Example: if mating_pop_ids = [0, 2, 3, 6, 5] then the individuals are crossover as: [0, 2], [3, 6], [5, 0]. Note: if the number of elements is odd, the last individual is crossed over with the first one.

Parameters:
  • pop (np.ndarray) – Array of all individuals

  • mating_pop_ids (list, optional) –

    Indices of population members to mate, by default None, which shuffles and

    mates whole population

Returns:

The offspring produced as a result of crossover.

Return type:

np.ndarray

class desdeo_emo.recombination.SinglePointCrossoverMutation.SinglePoint_Mutation(ProC: float = 1, DisC: float = 30)[source]

Simple single point crossover and mutation.

Parameters
ProCfloat, optional

[description], by default 1

DisCfloat, optional

[description], by default 30

mutation(indi)[source]

Simple mutation. Arg:

indi: individual to mutation.

do(offspring: numpy.ndarray)[source]
Consecutive members of mating_pop_ids are crossed over

in pairs. Example: if mating_pop_ids = [0, 2, 3, 6, 5] then the individuals are crossover as: [0, 2], [3, 6], [5, 0]. Note: if the number of elements is odd, the last individual is crossed over with the first one.

Parameters:
  • pop (np.ndarray) – Array of all individuals

  • mating_pop_ids (list, optional) –

    Indices of population members to mate, by default None, which shuffles and

    mates whole population

Returns:

The offspring produced as a result of crossover.

Return type:

np.ndarray