Callbacks¶
Events¶
Base class for all callback events. |
|
Fired once when the optimization run starts. |
|
Fired once when the optimization run ends. |
|
Fired at the beginning of each generation. |
|
Fired at the end of each generation, before yielding the context. |
|
Fired before surrogate-based candidate scoring. |
|
Fired after surrogate-based candidate scoring. |
|
Fired after crossover and repair. |
|
Fired after mutation and repair. |
|
Fired after the full ask step (post crossover and mutation). |
|
Fired after the surrogate model is fitted. |
|
Fired after true evaluation of selected candidates. |
Callback Manager¶
Manages event handlers. |
Built-in Handlers¶
- saealib.logging_generation(event)[source]¶
Log the state at the start of each generation.
For single-objective problems, logs the best objective value determined by the comparator. For multi-objective problems, logs the size of the first Pareto front and the per-objective value ranges of that front.
- Parameters:
event (GenerationStartEvent) – The generation-start event.
- Return type:
None
- saealib.logging_generation_hv(reference_point)[source]¶
Return a handler that logs the hypervolume per generation.
Computes the hypervolume of the first Pareto front in the archive with respect to the given reference point (minimization convention).
- Parameters:
reference_point (np.ndarray) – Reference (nadir) point, shape (n_obj,). Each component should be strictly greater than the best achievable value per objective.
- Returns:
A handler compatible with
CallbackManager.register.- Return type:
Callable[[GenerationStartEvent], None]
Examples
>>> optimizer.cbmanager.register( ... GenerationStartEvent, ... logging_generation_hv(np.array([1.1, 1.1])) ... )