2 Star 14 Fork 4

westwood / 蚁群算法

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
plt.ion.py 696 Bytes
一键复制 编辑 原始数据 按行查看 历史
westwood 提交于 2019-11-02 20:23 . 初始化项目
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 25 23:28:29 2017
@author: wyl
"""
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import numpy as np
import math
plt.close() # clf() # 清图 cla() # 清坐标轴 close() # 关窗口
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.axis("equal") # 设置图像显示的时候XY轴比例
plt.grid(True) # 添加网格
plt.ion() # interactive mode on
print('开始仿真')
try:
for t in range(180):
x = np.random.randint(-100, 100)
y = np.random.randint(-100, 100)
plt.scatter(x, y)
plt.pause(0.001)
if t >= 100:
plt.cla()
except Exception as err:
print(err)
Python
1
https://gitee.com/cm_westwood/ant_colony_algorithm.git
git@gitee.com:cm_westwood/ant_colony_algorithm.git
cm_westwood
ant_colony_algorithm
蚁群算法
master

搜索帮助