summaryrefslogtreecommitdiffstats
path: root/vprtw_aco_figure.py
diff options
context:
space:
mode:
authorJonZhao <[email protected]>2019-06-02 19:36:03 +0800
committerJonZhao <[email protected]>2019-06-02 19:36:03 +0800
commit11e7a1a71de69813ec7a7ef7469e8cf40ca60df3 (patch)
tree5cdf27f48289410842284d178a5576aad32925c4 /vprtw_aco_figure.py
parent64ea2265e21e678a2c36fa32da6390456ae3a235 (diff)
downloadVRPTW-ACO-python-11e7a1a71de69813ec7a7ef7469e8cf40ca60df3.tar.gz
VRPTW-ACO-python-11e7a1a71de69813ec7a7ef7469e8cf40ca60df3.tar.bz2
VRPTW-ACO-python-11e7a1a71de69813ec7a7ef7469e8cf40ca60df3.zip
使用一个进程来跑macs
Diffstat (limited to 'vprtw_aco_figure.py')
-rw-r--r--vprtw_aco_figure.py6
1 files changed, 3 insertions, 3 deletions
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)