saealib.Termination¶
- class saealib.Termination(*conditions)[source]¶
Bases:
objectTermination class to determine when to stop the optimization process.
Accepts one or more callable conditions. Each condition receives an
OptimizationContextand returnsTruewhen the process should terminate. The optimization stops when any condition evaluates toTrue.- Parameters:
*conditions (TerminationCondition) – One or more callable conditions. Each must accept an
OptimizationContextand returnbool.- Raises:
ValueError – If no conditions are provided.
TypeError – If any condition is not callable.
Examples
>>> termination = Termination(max_fe(2000)) >>> termination = Termination(max_fe(2000), max_gen(100)) >>> termination = Termination( ... max_fe(2000), ... lambda ctx: ctx.archive.get("f").min() < 1e-6, ... )
Methods
Check if any termination condition is met. |
Method Details