114 Agent-Based Modeling and Simulation with Swarm
5.2 Swarm simulation of the pheromone trails of ants
An easy model can describe the actions of ants as follows:
• In the case of nothing, a random search is done.
• If the food is found, it takes it back to the hive. A homing ant knows
the positio n of the hive, and returns almost straig ht back.
• Ants that take the food back to the hive drop their pheromone.
Pheromones are volatile.
• Ants not having the food have the habit of being attracted to the
pheromone.
Figure 5.4 is the ex e c utio n sta te in Swarm. Here, the hives are placed in
the center, and there are three (lower right, upper left, lower left) food sources.
Figure 5.4(a) is the first random search pha se. In (b), the c loser lower right
and lower left food is found, and the pheromone trail is formed. The upper
left is in the middle of the formation. In (c), pheromone trails are formed
for all three sources, which makes the trans port more efficient. The lower
right source is almost exhaustively picked. In (d), the lower right food source
finishes, and the pheromone trail is already dissipated. As a result, a vigorous
transportatio n fo r the two sources on the left is being done. After this, all the
sources finish, and the ants return to random search again. The parameters
in the simulation are shown in Table 5.1.
In this program, at the time of stopping, food locations and various pa-
rameters can be changed dynamically. For this purpose, the probe method is
used, as described in Section 3.2.7. Specific ope rations are as follows:
• To change evapora tion and diffusion coefficients: Enter the variable and
press “enter.” Then click “initializeEvaporationAndDiffusionRate.”
• To change the bugs’ parameters or colony size: Enter the variable and
press “enter.” Then click “initializeBugAndColonySize.”
• To change foods’ positio ns: Enter x, y coordinates and press “enter.”
Then click “initializeFood.”
• To add a food source: Enter x, y coordinates and ra dius and press “enter.”
Then click “initializeFood.”
• To delete a food source: Enter the minus value in the food’s radius and
press “enter.” Then click “initializeFood.”
Let us try and check how the ants’ behavior changes when the food loca-
tion is changed. Especially, how robust is the search using pheromones under
disturbances?