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

Function plot_result

pyvrp/plotting/plot_result.py:10–40  ·  view source on GitHub ↗

Plots the results of a run, including the best solution and detailed statistics about the algorithm's performance. Parameters ---------- result Result to be plotted. data Data instance underlying the result's solution. fig Optional Figure to draw

(
    result: Result, data: ProblemData, fig: plt.Figure | None = None
)

Source from the content-addressed store, hash-verified

8
9
10def plot_result(
11 result: Result, data: ProblemData, fig: plt.Figure | None = None
12):
13 """
14 Plots the results of a run, including the best solution and detailed
15 statistics about the algorithm's performance.
16
17 Parameters
18 ----------
19 result
20 Result to be plotted.
21 data
22 Data instance underlying the result's solution.
23 fig
24 Optional Figure to draw on. One will be created if not provided.
25 """
26 if not fig:
27 fig = plt.figure(figsize=(20, 12))
28
29 # Uses a GridSpec instance to lay-out all subplots nicely. There are
30 # two columns: left and right. Left has two rows, each containing a
31 # plot with statistics: the first plots each iteration's objective
32 # information, and the second plots iteration runtimes. The right column
33 # plots the solution on top of the instance data.
34 gs = fig.add_gridspec(2, 2, width_ratios=(2 / 5, 3 / 5))
35
36 ax_div = fig.add_subplot(gs[0, 0])
37 plot_objectives(result, ax=ax_div)
38 plot_runtimes(result, ax=fig.add_subplot(gs[1, 0], sharex=ax_div))
39
40 plot_solution(result.best, data, ax=fig.add_subplot(gs[:, 1]))

Callers

nothing calls this directly

Calls 3

plot_objectivesFunction · 0.90
plot_runtimesFunction · 0.90
plot_solutionFunction · 0.90

Tested by

no test coverage detected