Optimization Workflows
The section Running a basic optimization task explains how to run a
single optimization using the BasicOptimizer
class. Although this is sufficient for simple optimization tasks, this class may be
limited for more complex workflows.
Workflows provide a powerful and flexible framework for constructing and executing optimization workflows. It is designed to handle both simple, single-run optimizations and more complex, customized scenarios. The framework is built upon three key components:
ComputeStep: Defines a distinct action within the workflow, such as running an optimization algorithm.EventHandler: Responds to events emitted byComputeStepinstances. This allows for real-time monitoring, storing results, or triggering custom logic during the workflow.Evaluator: Provides a mechanism forComputeStepobjects to perform function evaluations, such as running simulations on a high-performance computing (HPC) cluster.
Compute steps, event handlers are executed by calling their
run method. During execution,
compute steps may emit events to communicate
intermediate results. Event handlers can be added to compute steps using the
add_event_handler
method. Many compute steps, such as those performing optimizations, will require
the repeated evaluation of a function, which is performed by evaluator objects
passed to the step upon creation.