【多智能体建模】01-蚂蚁觅食

52 阅读1分钟

简介

“蚂蚁觅食”这个多智能体模型主要模拟的现象是:

When an ant finds a piece of food, it carries the food back to the nest, dropping a chemical as it moves. When other ants “sniff” the chemical, they follow the chemical toward the food. As more ants carry food to the nest, they reinforce the chemical trail.

当一只蚂蚁找到一块食物时,它会把食物带回巢穴,并在移动过程中丢弃一种化学物质。当其他蚂蚁 "嗅到 "这种化学物质时,它们就会跟着化学物质向食物的方向移动。当更多的蚂蚁把食物运回巢穴时,它们就会加强化学痕迹。

本文意图是在重新在NetLogo实现“蚂蚁觅食”这个多智能体模型时掌握NetLogo相关技术。

NetLogo 实现分析

参照NetLogo模型库中的"Ants"模型实现来分析,可以大概分析出以下实现部分:

mindmap
实现
    输入
        按钮触发
        参数调控
    输出
        模拟图形移动
        数据图表

其中,显著的两个区分部分分别是:

  1. 输入
  2. 输出

image.png

输入的调控包括:

  1. 按钮事件触发
    1. 初始化设置setup
    2. 开始运行go
  2. 参数调控
    1. 蚂蚁人口population
    2. 信息素扩散率diffusion-rate
    3. 信息素蒸发率evaporation-rate

例程

mindmap
setup
  setup-patches
    setup-nest
    setup-food
    recolor-patch