Skip to content

Optimization Events

ropt.events

The events a compute step emits at lifecycle milestones.

An EnOptEvent carries the event type, the context of the run, and any results produced. Event handlers consume these to track progress, store results, or stop the run. See EnOptEventType for the available types, and Optimization Workflows for usage.

EnOptEvent dataclass

Container for data emitted with optimization workflow events.

Attributes:

Name Type Description
event_type EnOptEventType

Type of event that occurred.

context EnOptContext

Optimizer context associated with the event.

results tuple[Results, ...]

Tuple of result objects associated with the event.

source ComputeStep[Any] | None

The compute step that emitted the event.

A handler may call source.stop() to stop the run that emitted the event.

See Optimization Workflows for a detailed description of events and their lifecycle.