def ini_plot(self):
self.plot1 = self.figure.add_subplot(211)
self.plot1.set_title("Number of Lines: " +str(self.iter.Lines.num))
self.plot2 = self.figure.add_subplot(212)
self.plot2.set_title(('Best Tour length: %0.1f ' % (self.iter.Fittness.best_fittness[-1])))
self.plot2.set_xlabel('Iteration')
self.plot2.set_ylabel('Tour Length')
nr = 0
self.plot1.hold(True)
for line in self.iter.Lines.lines:
line.plot_line(self.plot1,'-ro')
line.add_text(self.plot1, str(nr))
nr += 1
self.lines1 = []
con_lines = self.gen_plot_route()
for line in con_lines:
line.plot_line(self.plot1,'-b')
best_fittness = self.iter.Fittness.best_fittness
self.line2 = self.plot2.plot(range(len(best_fittness)), best_fittness, 'r-')
self.plot2.set_ylim(0, best_fittness[0]+5)
self.canvas.show()
travelling_salesman_problem_2.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录