Skip to main content

AGGEATensor

Module: opytimizer.optimizers.single_objective.evolutionary.aggea

Tensorized (NumPy / CuPy) AG-GEA: the same graph, run on the whole population.

Every block is a batched gather, an element-wise operation or a sort, so a generation runs on the device without host synchronization.

Constructor​

AGGEATensor(params: 'Optional[Dict[str, Any]]' = None, n_tournaments: 'int' = 10, n_exchanges: 'int' = 10, n_crossovers: 'int' = 2, n_mutations: 'int' = 2, exchange_size: 'int' = 2, crossover_size: 'int' = 3, tournament_sizes: 'Optional[Sequence[int]]' = None, exchange_probabilities: 'Optional[Any]' = None, crossover_means: 'Optional[Any]' = None, crossover_stds: 'Optional[Any]' = None, crossover_weights: 'Optional[Any]' = None, mutation_stds: 'Optional[Any]' = None, mutation_weights: 'Optional[Any]' = None, crossover_split: 'Optional[Any]' = None, n_offspring: 'Optional[int]' = None) -> 'None'

Parameters​

ParameterTypeDefaultDescription
paramsOptional[Dict[str, Any]]NoneContains key-value parameters to the meta-heuristics.
n_tournamentsint10Number of Tournament blocks.
n_exchangesint10Number of Exchange blocks.
n_crossoversint2Number of Crossover blocks.
n_mutationsint2Number of Mutation blocks.
exchange_sizeint2Parents per Exchange offspring (n_e).
crossover_sizeint3Parents per Crossover offspring (n_c).
tournament_sizesOptional[Sequence[int]]Nonem of each Tournament block, in [1, 10].
exchange_probabilitiesOptional[Any]None(p_1, ..., p_ne) of each Exchange block.
crossover_meansOptional[Any]NoneMeans of the weights (w_2, ..., w_nc), of shape (n_crossovers, components, n_c - 1) (broadcastable).
crossover_stdsOptional[Any]NoneStandard deviations with the same shape.
crossover_weightsOptional[Any]NoneProbability of each mixture component per block.
mutation_stdsOptional[Any]NoneStandard deviations of w_0 per block and component.
mutation_weightsOptional[Any]NoneProbability of each mutation component per block. Defaults to a perturbation probability of 1 / n_variables.
crossover_splitOptional[Any]NoneRatio of each Crossover block's offspring sent to each Mutation block.
n_offspringOptional[int]NoneMinimum number of offspring per generation (defaults to the population size); it is rounded up so that every division of the graph is exact.

Methods​

compile​

compile(self, space: '_SingleObjectiveTensorSpace') -> 'None'

Prepares the block parameters on the space's backend.

Parameters​

ParameterTypeDefaultDescription
space_SingleObjectiveTensorSpace—

evaluate​

evaluate(self, space: '_SingleObjectiveTensorSpace', function: 'Function') -> 'None'

Evaluates the initial population (offspring are evaluated in update).

Parameters​

ParameterTypeDefaultDescription
space_SingleObjectiveTensorSpace—
functionFunction—

update​

update(self, space: '_SingleObjectiveTensorSpace', function: 'Function') -> 'None'

Performs one generation: offspring creation and (mu + lambda) selection.

Parameters​

ParameterTypeDefaultDescription
space_SingleObjectiveTensorSpaceA tensorized SingleObjectiveSpace object.
functionFunctionA Function object that will be used as the objective function.