Tests that ILS uses the initial solution to initialise the best found solution.
(rc208)
| 84 | |
| 85 | |
| 86 | def test_best_initial_solution(rc208): |
| 87 | """ |
| 88 | Tests that ILS uses the initial solution to initialise the best found |
| 89 | solution. |
| 90 | """ |
| 91 | rng = RandomNumberGenerator(seed=42) |
| 92 | pm = PenaltyManager(initial_penalties=([20], 6, 6)) |
| 93 | ls = LocalSearch(rc208, rng, compute_neighbours(rc208)) |
| 94 | bks = read_solution("data/RC208.sol", rc208) |
| 95 | algo = IteratedLocalSearch(rc208, pm, rng, ls, bks) |
| 96 | |
| 97 | result = algo.run(MaxIterations(0)) |
| 98 | |
| 99 | # The best known solution is the initial solution. Since we don't run any |
| 100 | # iterations, this should be returned as best solution. |
| 101 | assert_equal(result.best, bks) |
| 102 | |
| 103 | |
| 104 | def test_ils_result_has_correct_stats(ok_small): |
nothing calls this directly
no test coverage detected