Compares plots generated by ``plot_result``.
(ok_small)
| 80 | |
| 81 | @img_comp(["plot_result"], **IMG_KWARGS) |
| 82 | def test_plot_result(ok_small): |
| 83 | """ |
| 84 | Compares plots generated by ``plot_result``. |
| 85 | """ |
| 86 | sols = [ |
| 87 | Solution(ok_small, [[1, 2], [3, 4]]), |
| 88 | Solution(ok_small, [[1, 2], [4, 3]]), |
| 89 | Solution(ok_small, [[2, 1], [3, 4]]), |
| 90 | ] |
| 91 | cost_eval = CostEvaluator([20], 6, 6) |
| 92 | bks = min(sols, key=cost_eval.penalised_cost) |
| 93 | stats = Statistics() |
| 94 | num_iters = 10 |
| 95 | |
| 96 | for idx in range(num_iters): |
| 97 | curr = sols[idx % len(sols)] |
| 98 | cand = sols[(idx + 1) % len(sols)] |
| 99 | stats.collect(curr, cand, bks, cost_eval) |
| 100 | |
| 101 | res = Result(bks, stats, num_iters, 0.0) |
| 102 | plotting.plot_result(res, ok_small) |
| 103 | |
| 104 | |
| 105 | @img_comp(["plot_instance"], **IMG_KWARGS) |
nothing calls this directly
no test coverage detected