Skip to content

Optimization Events

ropt.events

The events an optimization or evaluation emits at its lifecycle milestones.

An EnOptEvent carries the event type, the configuration in use, and any results produced. Event handlers consume these to prepare evaluations, track progress, store results, or stop the optimization. See EnOptEventType for the available types, and Handling Results for usage.

EnOptEvent dataclass

Container for the data emitted with an event.

Attributes:

Name Type Description
event_type EnOptEventType

Type of event that occurred.

context EnOptContext

The validated configuration in use.

results tuple[Results, ...]

Tuple of result objects associated with the event.

stop Callable[[], None] | None

Stops the optimization that emitted the event.

metadata dict[str, object]

Metadata for the upcoming batch; used only for START_EVALUATION.

See Handling Results for when each event fires and what it carries.