Stopping criteria
The pyvrp.stop
module contains the various stopping criteria the pyvrp
package ships with.
These can be used to stop the GeneticAlgorithm
’s’ search whenever some criterion is met: for example, when some maximum number of iterations or run-time is exceeded.
All stopping criteria implement the StoppingCriterion
protocol.
- class StoppingCriterion(*args, **kwargs)
Protocol that stopping criteria must implement.
Methods
__call__
(best_cost)When called, this stopping criterion should return True if the algorithm should stop, and False otherwise.
- class MaxIterations(max_iterations: int)
Criterion that stops after a maximum number of iterations.
Methods
__call__
(best_cost)Call self as a function.
- class MaxRuntime(max_runtime: float)
Criterion that stops after a specified maximum runtime.
Methods
__call__
(best_cost)Call self as a function.