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
| Parameter | Type | Default | Description |
|---|---|---|---|
params | Optional[Dict[str, Any]] | None | Contains key-value parameters to the meta-heuristics. |
n_tournaments | int | 10 | Number of Tournament blocks. |
n_exchanges | int | 10 | Number of Exchange blocks. |
n_crossovers | int | 2 | Number of Crossover blocks. |
n_mutations | int | 2 | Number of Mutation blocks. |
exchange_size | int | 2 | Parents per Exchange offspring (n_e). |
crossover_size | int | 3 | Parents per Crossover offspring (n_c). |
tournament_sizes | Optional[Sequence[int]] | None | m of each Tournament block, in [1, 10]. |
exchange_probabilities | Optional[Any] | None | (p_1, ..., p_ne) of each Exchange block. |
crossover_means | Optional[Any] | None | Means of the weights (w_2, ..., w_nc), of shape (n_crossovers, components, n_c - 1) (broadcastable). |
crossover_stds | Optional[Any] | None | Standard deviations with the same shape. |
crossover_weights | Optional[Any] | None | Probability of each mixture component per block. |
mutation_stds | Optional[Any] | None | Standard deviations of w_0 per block and component. |
mutation_weights | Optional[Any] | None | Probability of each mutation component per block. Defaults to a perturbation probability of 1 / n_variables. |
crossover_split | Optional[Any] | None | Ratio of each Crossover block's offspring sent to each Mutation block. |
n_offspring | Optional[int] | None | Minimum 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
| Parameter | Type | Default | Description |
|---|---|---|---|
space | _SingleObjectiveTensorSpace | — |
evaluate
evaluate(self, space: '_SingleObjectiveTensorSpace', function: 'Function') -> 'None'
Evaluates the initial population (offspring are evaluated in update).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
space | _SingleObjectiveTensorSpace | — | |
function | Function | — |
update
update(self, space: '_SingleObjectiveTensorSpace', function: 'Function') -> 'None'
Performs one generation: offspring creation and (mu + lambda) selection.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
space | _SingleObjectiveTensorSpace | A tensorized SingleObjectiveSpace object. | |
function | Function | A Function object that will be used as the objective function. |