MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / MaxIterations

Class MaxIterations

pyvrp/stop/MaxIterations.py:1–16  ·  view source on GitHub ↗

Criterion that stops after a maximum number of iterations.

Source from the content-addressed store, hash-verified

1class MaxIterations:
2 """
3 Criterion that stops after a maximum number of iterations.
4 """
5
6 def __init__(self, max_iterations: int):
7 if max_iterations < 0:
8 raise ValueError("max_iterations < 0 not understood.")
9
10 self._max_iters = max_iterations
11 self._curr_iter = 0
12
13 def __call__(self, best_cost: float) -> bool:
14 self._curr_iter += 1
15
16 return self._curr_iter > self._max_iters

Callers 15

_solveFunction · 0.90
test_solve_same_seedFunction · 0.90
test_solve_custom_paramsFunction · 0.90
test_OkSmallFunction · 0.90
test_rc208Function · 0.90
test_X_instanceFunction · 0.90
test_from_data_and_solveFunction · 0.90

Calls

no outgoing calls

Tested by 15

test_solve_same_seedFunction · 0.72
test_solve_custom_paramsFunction · 0.72
test_OkSmallFunction · 0.72
test_rc208Function · 0.72
test_X_instanceFunction · 0.72
test_from_data_and_solveFunction · 0.72
test_model_and_solveFunction · 0.72