saealib.AskStage#

class saealib.AskStage(algorithm, n_offspring=None, cbmanager=None)[ソース]#

ベースクラス: Stage

Generate offspring candidates via the algorithm's ask() method.

Writes the offspring population to state.offspring.

パラメータ:
  • algorithm (Algorithm) -- The evolutionary algorithm that generates candidates.

  • n_offspring (int or None) -- Number of offspring to request. Passed directly to algorithm.ask(). None lets the algorithm decide.

  • cbmanager (CallbackManager or None) -- If provided, PostCrossoverEvent / PostMutationEvent / PostAskEvent are dispatched through this manager.

Methods

__init__

Initialize base Stage attributes.

contract

Return this stage's structural and direct state-access contract.

execute

Execute this stage and return the updated state.

to_pseudocode

Expand into per-operator lines via Algorithm.ask_notation.

to_text

Render this stage as a plain-text algorithmic line.

Method Details

AskStage.__init__(algorithm, n_offspring=None, cbmanager=None)[ソース]#

Initialize base Stage attributes.

パラメータ:
  • name (str, optional) -- Override the class-level name.

  • label (str, optional) -- Override the class-level label.

  • notation (str, optional) -- Override the class-level notation.

  • algorithm (Algorithm | Proposer)

  • n_offspring (int | None)

  • cbmanager (CallbackManager | None)

戻り値の型:

None

AskStage.contract()[ソース]#

Return this stage's structural and direct state-access contract.

戻り値の型:

ComponentContract

AskStage.execute(state)[ソース]#

Execute this stage and return the updated state.

パラメータ:

state (OptimizationState) -- Current optimization state.

戻り値:

Updated state.

戻り値の型:

OptimizationState

AskStage.to_pseudocode(*, expand=False, indent=0)[ソース]#

Expand into per-operator lines via Algorithm.ask_notation.

パラメータ:
  • expand (bool)

  • indent (int)

戻り値の型:

str

AskStage.to_text(*, expand=False, indent=0)#

Render this stage as a plain-text algorithmic line.

パラメータ:
  • expand (bool)

  • indent (int)

戻り値の型:

str