pg.evolution.selectors.First¶
Accessible via pg.evolution.selectors.First
.
- class First(n=None)[source]¶
Bases:
pg.evolution.Selector
First N selector.
Methods:
select
(inputs, step)Select a list of outputs from the inputs.
- select(inputs, 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.