saealib.SurrogateOnlyLoopStage#

class saealib.SurrogateOnlyLoopStage(algorithm, surrogate_manager, gen_ctrl, cbmanager=None, *, acquisition, feedback_builder=None)[source]#

Bases: Stage

Run gen_ctrl surrogate-only generations before real evaluation.

Fits the surrogate model once on the current archive, then repeats gen_ctrl times: CountGeneration → Ask → SurrogatePredict(refit=False) → Acquisition → Tell. If gen_ctrl is 0 this stage is a no-op.

Used by GenerationBasedStrategy to execute inner surrogate-driven generations before a single true-evaluation generation.

Parameters:
  • algorithm (Algorithm) – Evolutionary algorithm for ask/tell.

  • surrogate_manager (SurrogateManager) – Manager used for fitting and prediction.

  • gen_ctrl (int) – Number of surrogate-only generations.

  • cbmanager (CallbackManager or None) – Forwarded to inner stages for event dispatching.

  • acquisition (AcquisitionFunction) – Acquisition function used to score offspring inside the inner loop. Keyword-only so existing positional SurrogateOnlyLoopStage(algorithm, surrogate_manager, gen_ctrl, cbmanager) calls stay valid.

  • feedback_builder (FeedbackBuilder | None)

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

Render as a \For loop block when expand is True.

to_text

Render this stage as a plain-text algorithmic line.

Method Details

SurrogateOnlyLoopStage.__init__(algorithm, surrogate_manager, gen_ctrl, cbmanager=None, *, acquisition, feedback_builder=None)[source]#

Initialize base Stage attributes.

Parameters:
Return type:

None

SurrogateOnlyLoopStage.contract()[source]#

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

Return type:

ComponentContract

SurrogateOnlyLoopStage.execute(state)[source]#

Execute this stage and return the updated state.

Parameters:

state (OptimizationState) – Current optimization state.

Returns:

Updated state.

Return type:

OptimizationState

SurrogateOnlyLoopStage.to_pseudocode(*, expand=False, indent=0)[source]#

Render as a \For loop block when expand is True.

Parameters:
  • expand (bool)

  • indent (int)

Return type:

str

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

Render this stage as a plain-text algorithmic line.

Parameters:
  • expand (bool)

  • indent (int)

Return type:

str