Python 有啥启发式算法的包吗( 三 )
画出结果fig, ax = plt.subplots(1, 1)best_points_ = np.concatenate(]])best_points_coordinate = points_coordinateax.plot(best_points_coordinate, best_points_coordinate, \u0026#39;o-r\u0026#39;)plt.show()
4. 蚁群算法解决TSP问题蚁群算法(ACA, Ant Colony Algorithm)aca = ACA_TSP(func=cal_total_distance, n_dim=8, size_pop=10, max_iter=20, distance_matrix=distance_matrix)best_x, best_y = aca.run()
5. 免疫优化算法(immune algorithm, IA)from sko.IA import IA_TSP_g as IA_TSPia_tsp = IA_TSP(func=cal_total_distance, n_dim=num_points, pop=500, max_iter=2000, Pm=0.2, T=0.7, alpha=0.95)best_points, best_distance = ia_tsp.run()print(\u0026#39;best routine:\u0026#39;, best_points, \u0026#39;best_distance:\u0026#39;, best_distance)
6. 人工鱼群算法(artificial fish swarm algorithm, AFSA)def func(x): x1, x2 = x return 1 / x1 ** 2 + x1 ** 2 + 1 / x2 ** 2 + x2 ** 2from sko.ASFA import ASFAasfa = ASFA(func, n_dim=2, size_pop=50, max_iter=300, max_try_num=100, step=0.5, visual=0.3, q=0.98, delta=0.5)best_x, best_y = asfa.run()print(best_x, best_y)库的地址,欢迎star
scikit-opt另外,这个库总共封装了遗传算法(GA)、粒子群算法(PSO)、蚁群算法(ACA)、模拟退火算法(SA)、免疫优化算法(IA)、人工鱼群算法(AFSA)。文档在下面,大家探索吧。
中文文档Document
■网友
同求。只要傻瓜式的API,写入目标函数,上下限,迭代次数,种群数,就可以运行的那种。类似matlab优化工具箱。不是研究算法的,所以那些框架式库,太高深了啊
■网友
pyevolve,一个GA算法包Welcome to Pyevolve documentation !
■网友
自问自答补一个进化算法的包DEAP/deap
■网友
推荐用Python的Geatpy,速度比C++写的还要快。而且支持GA、ES、DE、MOEA等,高度模块化,耦合度很小,可快速求解实际问题。中文网站:
Geatpy中文网站
■网友
Deap比较的落后。速度慢,代码乱,难以进行二次开发。建议用目前性能最高、易用性最好的Python的高性能实用型进化算法工具箱。
Geatpy 【Python 有啥启发式算法的包吗】
推荐阅读
- 有啥方法,网站,项目可以自己练习计算广告学
- 怎样成为一名合格的Python程序员?
- python 爬虫,咋获得输入验证码之后的搜索结果
- 100W——150W有啥好的车
- python的html5lib这个库咋使用啊我在网上也没有找到相关文档
- 最近有啥样的交友软件比较好玩呢
- 最近有啥好期待的网游玩
- 电子信息工程考研有啥偏软件类的专业可以报考
- 淘宝上有啥体验不错的假货,赝品或者山寨货?
- 零基础入门学习啥语言好
