找回密码
 立即注册
蚂蚁The食物ants | 数据结构 2022-10-06 104 0star收藏 版权: . 保留作者信息 . 禁止商业使用 . 禁止修改作品
代码放到了word中,大家可以自己运行。算法解说:程序开始运行,蚂蚁们开始从窝里出动了,寻觅食物;他们会顺着屏幕爬满全面画面,直到找到食物再回来窝。其中,‘F’点表明食物,‘H’表明窝,白色块表明障碍物,‘+’即是蚂蚁了。预期的结果:各个蚂蚁在没有事先通知他们食物在什么地方的前提下开始寻觅食物。当一只找到食物今后,它会向环境释放一种信息素,招引别的的蚂蚁过来,这样不断增加的蚂蚁会找到食物!部分蚂蚁并没有象其它蚂蚁相同总重复相同的路,他们会另辟蹊径,假如令拓荒的路途比原来的别的路途更短,那么,逐渐,更多的蚂蚁被招引到这条较短的路上来。最终,通过一段时间运行,可能会呈现一条最短的途径被大多数蚂蚁重复着。则蚂蚁越简单原地转圈。
蚁群算法源程序.doc

(The code is placed in Word, and you can run it yourself. Algorithm explanation: The program starts to run, and ants start to move out of the nest to look for food; They will crawl along the screen until they find food and then return to the nest. Among them, 'F' point indicates food, 'H' indicates nest, white block indicates obstacle, and ' ' indicates ant. Expected results: Each ant starts to look for food without informing them where the food is. When one finds food, it will release a pheromone to the environment to attract other ants, so that the increasing number of ants will find food! Some ants do not always repeat the same way as other ants. They will find a new way. If the road to pioneer is shorter than the original one, then gradually more ants will be attracted to this shorter road. Finally, after running for a period of time, the shortest path may be repeated by most ants. The easier it is for ants to circle in place.
Ant Colony Algorithm Source.doc)

[下载]10361093064.rar




上一篇:数据结构冒泡算法
下一篇:C语言,程序的灵魂---------算法初步认识.pdf