(params: IteratedLocalSearchParams)
| 198 | ] |
| 199 | |
| 200 | def run(params: IteratedLocalSearchParams): # run with given params |
| 201 | idx = iter(range(len(sols))) |
| 202 | ils = IteratedLocalSearch( |
| 203 | ok_small, |
| 204 | PenaltyManager(initial_penalties=([20], 6, 6)), |
| 205 | RandomNumberGenerator(42), |
| 206 | lambda *_, **kw: sols[next(idx)], # returns sols one at a time |
| 207 | sols[0], |
| 208 | params, |
| 209 | ) |
| 210 | |
| 211 | res = ils.run(MaxIterations(len(sols))) |
| 212 | return res.stats.data |
| 213 | |
| 214 | # First run without a restart. We look back to the current solution from |
| 215 | # last iteration, which means that we only accept improving solutions. |
no test coverage detected