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

Function test_plot_result

tests/plotting/test_plotting.py:82–102  ·  view source on GitHub ↗

Compares plots generated by ``plot_result``.

(ok_small)

Source from the content-addressed store, hash-verified

80
81@img_comp(["plot_result"], **IMG_KWARGS)
82def 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)

Callers

nothing calls this directly

Calls 5

collectMethod · 0.95
SolutionClass · 0.90
CostEvaluatorClass · 0.90
StatisticsClass · 0.90
ResultClass · 0.90

Tested by

no test coverage detected