Skip to main content
This is a dummy implementation that tracks state but doesn’t actually stop the optimization (that’s handled by CallbackManager). The callback sets a _should_stop flag when patience is exceeded.

Parameters

monitor
str
required
Metric name to monitor (e.g., “system_energy”, “best_system_energy”).
patience
int
required
Number of steps with no improvement before stopping. Ideally, this should be set as a multiple of the number of Minimizer steps necessary to mutate the entire sequence (for the largest State).
min_delta
float
default:"0.0"
Minimum change in the monitored metric to be considered an improvement.
mode
str
default:"'min'"
Whether lower (“min”) or higher (“max”) values are better.

Methods

on_optimization_start

Reset tracking state at the start of optimization. Parameters
context
CallbackContext
required

on_step_end

Check if monitored metric has improved and update tracking state. Parameters
context
CallbackContext
required

Example

early_stop = EarlyStopping(
    monitor="best_system_energy",
    patience=100,
    mode="min"
)