pg.evolution.Recombinator

Accessible via pg.evolution.Recombinator.

class Recombinator[source]

Bases: pg.evolution.DNAOperation

Base class for recombinators.

Attributes:

operation_method

Returns a member method as operation.

Methods:

recombine(parents, global_state, step)

Generate a list of child DNA based on the list of parents given.

property operation_method[source]

Returns a member method as operation.

abstract recombine(parents, global_state, step)[source]

Generate a list of child DNA based on the list of parents given.

User should override this method with optional keyword arguments ‘global_state’ and ‘step’.

The parents DNA contains a metadata field ‘generation’, which is the generation of the parent DNA. If the Recombinator does not assign this field for the new child DNA, the child DNA will have the maximum generation from the parents plus 1.

Return type:

List[pg.DNA]

Parameters:
  • parents – Parent trials.

  • global_state – An AttributeDict object as the global state container, which is readable/writable during the operation.

  • step – Number of examples historically proposed, which can be used for determining a cross over schedule.

Returns:

A list of generated child DNA.