saealib.GA

class saealib.GA(crossover, mutation, parent_selection, survivor_selection)[source]

Bases: Algorithm

Genetic Algorithm class.

Parameters:
crossover

Crossover operator.

Type:

Crossover

mutation

Mutation operator.

Type:

Mutation

parent_selection

Parent selection operator.

Type:

ParentSelection

survivor_selection

Survivor selection operator.

Type:

SurvivorSelection

Methods

__init__

Initialize GA (Genetic Algorithm) class.

ask

Generate offspring via crossover and mutation.

create_pareto_archive

Create a ParetoArchive with the correct direction for the problem.

get_required_attrs

Return algorithm-specific attributes (GA needs none beyond the defaults).

tell

Update the population using (μ+λ) survivor selection.

Method Details

GA.__init__(crossover, mutation, parent_selection, survivor_selection)[source]

Initialize GA (Genetic Algorithm) class.

Parameters:
GA.ask(ctx, provider, n_offspring=None)[source]

Generate offspring via crossover and mutation.

Parameters:
  • ctx (OptimizationContext) – Current optimization context.

  • provider (ComponentProvider) – Component provider.

  • n_offspring (int or None, optional) – Number of offspring. Defaults to the current population size.

Return type:

Population

GA.create_pareto_archive(attrs, init_capacity, problem)

Create a ParetoArchive with the correct direction for the problem.

Parameters:
Return type:

ParetoArchive

GA.get_required_attrs(problem)[source]

Return algorithm-specific attributes (GA needs none beyond the defaults).

Parameters:

problem (Problem)

Return type:

list[PopulationAttribute]

GA.tell(ctx, provider, offspring)[source]

Update the population using (μ+λ) survivor selection.

Parameters:
  • ctx (OptimizationContext) – Current optimization context.

  • provider (ComponentProvider) – Component provider.

  • offspring (Population) – Offspring population.