From 11e7a1a71de69813ec7a7ef7469e8cf40ca60df3 Mon Sep 17 00:00:00 2001 From: JonZhao <1044264932@qq.com> Date: Sun, 2 Jun 2019 19:36:03 +0800 Subject: =?UTF-8?q?=E4=BD=BF=E7=94=A8=E4=B8=80=E4=B8=AA=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E6=9D=A5=E8=B7=91macs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vprtw_aco_figure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vprtw_aco_figure.py') diff --git a/vprtw_aco_figure.py b/vprtw_aco_figure.py index 79fab72..98efe80 100644 --- a/vprtw_aco_figure.py +++ b/vprtw_aco_figure.py @@ -1,9 +1,9 @@ import matplotlib.pyplot as plt -from queue import Queue +from multiprocessing import Queue as MPQueue class VrptwAcoFigure: - def __init__(self, nodes: list, path_queue: Queue): + def __init__(self, nodes: list, path_queue: MPQueue): """ matplotlib绘图计算需要放在主线程,寻找路径的工作建议另外开一个线程, 当寻找路径的线程找到一个新的path的时候,将path放在path_queue中,图形绘制线程就会自动进行绘制 @@ -71,4 +71,4 @@ class VrptwAcoFigure: x_list = [self.nodes[path[i - 1]].x, self.nodes[path[i]].x] y_list = [self.nodes[path[i - 1]].y, self.nodes[path[i]].y] self.figure_ax.plot(x_list, y_list, color=self._line_color, linewidth=1.5, label='line') - plt.pause(0.02) + plt.pause(0.2) -- cgit v1.2.3