saealib.GA#

class saealib.GA(crossover, mutation, parent_selection, survivor_selection, *, duplicate_elimination=None, variation_execution='batch', integer_crossover=None, integer_mutation=None, categorical_crossover=None, categorical_mutation=None)[ソース]#

ベースクラス: AskTellAlgorithm

Genetic Algorithm class.

パラメータ:
crossover#

Crossover operator for continuous dimensions.

Type:

Crossover

mutation#

Mutation operator for continuous dimensions.

Type:

Mutation

parent_selection#

Parent selection operator.

Type:

ParentSelection

survivor_selection#

Survivor selection operator.

Type:

SurvivorSelection

integer_crossover#

Crossover operator for integer dimensions.

Type:

Crossover

integer_mutation#

Mutation operator for integer dimensions.

Type:

Mutation

categorical_crossover#

Crossover operator for categorical dimensions.

Type:

Crossover

categorical_mutation#

Mutation operator for categorical dimensions.

Type:

Mutation

duplicate_elimination#

When set, offspring that duplicate any member of the current population are replaced by re-generated candidates (up to max_retries attempts). None disables duplicate elimination (default behaviour).

Type:

DuplicateElimination or None

variation_execution#

Execution mode for crossover and mutation. A string applies to both; a dict may set "crossover" and "mutation" independently, with omitted keys defaulting to "batch". In batch mode, all gate decisions and operations complete before any post-operation hook runs, so a stateful hook cannot influence a later individual's operation. Sequential mode completes each individual's operation and hook before starting the next, preserving the pre-batching behavior byte-for-byte. Mixed-variable problems now use per-type batch operations by default, which changes their historical random-number sequence; select sequential mode to preserve it. This is a semantic choice, not only a performance setting.

Type:

{"batch", "sequential"} or dict

Methods

__init__

Initialize GA (Genetic Algorithm) class.

ask

Generate offspring via crossover and mutation.

contract

Return the genetic-algorithm contract.

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, *, duplicate_elimination=None, variation_execution='batch', integer_crossover=None, integer_mutation=None, categorical_crossover=None, categorical_mutation=None)[ソース]#

Initialize GA (Genetic Algorithm) class.

パラメータ:
  • crossover (Crossover) -- Crossover operator for continuous dimensions.

  • mutation (Mutation) -- Mutation operator for continuous dimensions.

  • parent_selection (ParentSelection) -- Parent selection operator.

  • survivor_selection (SurvivorSelection) -- Survivor selection operator.

  • duplicate_elimination (DuplicateElimination, optional) -- When provided, offspring that duplicate any member of the current population are replaced by re-generated candidates. None (default) disables duplicate elimination.

  • variation_execution ({"batch", "sequential"} or dict, optional) -- Execution mode for crossover and mutation. A string applies to both operators. A dict may contain "crossover" and "mutation" independently; an omitted key defaults to "batch". In batch mode, every individual's gate decision and operation is computed before any post_crossover or post_mutation hook runs for any individual in that call. A stateful hook may observe earlier hooks in the subsequent post-processing pass, but cannot influence a later individual's operation. In sequential mode, each individual's complete operation-then-hook cycle finishes before the next begins, matching the library's pre-batching behavior byte-for-byte. This is a semantic choice, not only a performance setting. Mixed-variable problems use per-type batch operations by default, changing their historical random-number sequence; use sequential mode to preserve it.

  • integer_crossover (Crossover, optional) -- Crossover operator for integer dimensions. Defaults to CrossoverIntegerSBX with the same rate as crossover.

  • integer_mutation (Mutation, optional) -- Mutation operator for integer dimensions. Defaults to MutationIntegerUniform with the same rate as mutation.

  • categorical_crossover (Crossover, optional) -- Crossover operator for categorical dimensions. Defaults to CrossoverCategorical with the same rate as crossover.

  • categorical_mutation (Mutation, optional) -- Mutation operator for categorical dimensions. Defaults to MutationCategorical with the same rate as mutation.

GA.ask(request, state)[ソース]#

Generate offspring via crossover and mutation.

パラメータ:
  • request (ProposalRequest) -- Request-specific offspring count.

  • state (StateView) -- Read-only algorithm state view.

戻り値の型:

ProposalBatch

GA.contract()[ソース]#

Return the genetic-algorithm contract.

戻り値の型:

ComponentContract

GA.create_pareto_archive(attrs, init_capacity, problem)#

Create a ParetoArchive with the correct direction for the problem.

パラメータ:
戻り値の型:

ParetoArchive

GA.get_required_attrs(problem)[ソース]#

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

パラメータ:

problem (Problem)

戻り値の型:

list[PopulationAttribute]

GA.tell(feedback, state)[ソース]#

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

パラメータ:
  • feedback (FeedbackBatch) -- Feedback delivered for the current proposal.

  • state (StateView) -- Read-only algorithm state view.

戻り値の型:

StatePatch