saealib.Stage#

class saealib.Stage(*, name='', label='', notation='')[source]#

Bases: ABC

Abstract base class for a compatibility execution step.

A Stage receives an OptimizationState, performs one well-defined operation, and returns a (possibly new) state. Structured graph execution does not accept this boundary.

Parameters:
  • name (str)

  • label (str)

  • notation (str)

name#

Short machine-readable identifier used for lookup via pipeline["name"].

Type:

str

label#

Human-readable description of what this stage does.

Type:

str

notation#

LaTeX math expression used by to_pseudocode().

Type:

str

stages#

Sub-pipeline for composite stages. Empty list for leaf stages.

Type:

list[Stage]

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 this stage as a LaTeX algorithmic line.

to_text

Render this stage as a plain-text algorithmic line.

Method Details

Stage.__init__(*, name='', label='', notation='')[source]#

Initialize base Stage attributes.

Parameters:
  • name (str, optional) – Override the class-level name.

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

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

Return type:

None

Stage.contract()[source]#

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

Return type:

ComponentContract

abstractmethod Stage.execute(state)[source]#

Execute this stage and return the updated state.

Parameters:

state (OptimizationState) – Current optimization state.

Returns:

Updated state.

Return type:

OptimizationState

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

Render this stage as a LaTeX algorithmic line.

Parameters:
  • expand (bool) – If True and this stage has sub-stages, recursively expand them.

  • indent (int) – Current indentation level (number of \State indent steps).

Returns:

LaTeX algorithmic fragment.

Return type:

str

Stage.to_text(*, expand=False, indent=0)[source]#

Render this stage as a plain-text algorithmic line.

Parameters:
  • expand (bool)

  • indent (int)

Return type:

str