pg.evolution.Selector

Accessible via pg.evolution.Selector.

class Selector[source]

Bases: pg.evolution.Operation

Base class for selectors.

Attributes:

operation_method

Returns a member method as operation.

Methods:

select(inputs, global_state, step)

Select a list of outputs from the inputs.

property operation_method[source]

Returns a member method as operation.

abstract select(inputs, global_state, step)[source]

Select a list of outputs from the inputs.

A selector has two use cases: :rtype: List[Any]

  • Used as parents selector, which selects individuals from the population as parents for recombination. It will be called before the recombination step within the pg.evolution.Evolution method.

  • Used as a population updater, which selects individuals from previous population as a new population. It will be called everytime the population is updated, triggered by the pg.evolution.Evolution method.

Parameters:
  • inputs – a list of objects as input.

  • 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.