• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

snowland-algorithm-python: 用python3实现的人工智能仿生学算法(群智能算法)包括粒 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

snowland-algorithm-python

开源软件地址:

https://gitee.com/hoops/snowland-algorithm-python

开源软件介绍:

slapy

1. installfrom pypi:

pip install snowland-algorithm

orfrom source code:

download code from https://gitee.com/hoops/snowland-algorithm-python, you can choose a release versionpip install -r requirements.txtpython setup.py install
  1. dirs
    1. graph
      1. dijkstra(v0.0.1+)
      2. spfa(v0.0.1+)
    2. swarm
      1. pso(v0.0.1+)
      2. gso(v0.0.2+)
      3. fa(v0.0.3+)
      4. cso(v0.0.6+)
      5. ba(v0.0.6+)
      6. sfla(v0.0.6+)
      7. bas(v0.0.6+)
      8. sa(v0.0.6+)
      9. fwa(v0.0.6+)
  2. quick use

    1. import package>>> from slapy.swarm.package_name import engine_name2. define the fitness functionexample:

    >>> fun = lambda x: np.cos(x[0]) + np.sin(x[0]) - x[0] * x[1]

    note: arg need to be 1 X n vector3. run the model>>> engine = engine_name(your_args)>>> engine.run()4. show result>>> x, y = engine.gbest.chromosome>>> print('max value', fun(engine.gbest.chromosome))>>> print('x:', x, 'y:', y)There is a example for PSO.

    >>> def fun(vars):>>>     # fitness function>>>     x, y = vars>>>     if 1 <= x <= 2 * np.pi and 1 <= y <= np.pi:>>>         return np.cos(x) + np.sin(x) - x * y>>>     else:>>>         return -2 - 4 * np.pi ** 2  # return a small float number can not reach
    >>> if __name__ == '__main__':>>>    engine = PSOEngine(vmax=0.01, bound=[[1, 2 * np.pi]], min_fitness_value=-1, dim=2, fitness_function=fun, steps=100)>>>    engine.run()>>>    x, y = engine.gbest.chromosome>>>    print('max value', fun(engine.gbest.chromosome))>>>    print('x:', x, 'y:', y)

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap