The main goal of this project is to simulate and visualize an ant colony's use of pheromones to coordinate food gathering. Each ant only knows its state, its last step, and if it has food. They are able to create and follow meaningful trials using pheromones. These pheromones are properties of the terrain so the ants can only sense the pheromones right next to them. Each ant is modeled as a state machine, where each state dictates the ants simple set of rules.
All ants start out as Scout ants at the nest. These ants are combing the area for food. As they move along, they leave a pheromone trail, Scout_Pheromone(Ant_ID). This is used later for finding its way back to the nest. Scout ants search randomly, but avoid Scout_Pheromone (visualized as yellow) left by any other Scout ants. This allows the ants to avoid places others have already searched. A Scout ant can become a Creator and by finding a food source or a Follower ant by finding a Harvester ants Path_Pheromone(Ant_ID) trial.
If a Scout ant finds food, it becomes a Creator ant, whose goal is to create a clear trail back to the nest. Starting from the newly discovered food, the Creator follows its Scout_Pheromone(Ant_ID) trail back to the nest. This is not necessarily a trivial task; the Scouting trail likely crosses over itself resulting in forks. This not only is likely to create a longer than necessary path, it could also create a closed loop. To avoid this, the Creator ant chooses the path with the lowest positive concentration of pheromones. Because the pheromones are dissipating over time, this path was less recently traveled and therefore probably closer to the nest.
As the Creator ant is following its way back to the nest, it leaves a new pheromone trail, Path_Pheromone(Ant_ID). In this state, the pheromones are visualized as grey. Once the Creator ant has made it back to the nest, it becomes a Harvester ant.
If a Scout ant finds a Path_Pheromone trail (visualized as blue) left from any Harvester ant, it will become a Follower ant. This ant follows the the Path_Pheromone(Ant_ID) of the ant who left it, randomly choosing which direction on the path to go. As it follows the other ant's trial, the Follower ant leaves its own Path_Pheromone(Ant_ID) trail (visualized as gray). The following cases are of concern:
If a Follower ant successfully returns to the nest with food or if a Creator ant successfully finds its way back to the nest, the ant becomes a Harvester ant. This ants task is to continually follow its Path_Pheromone(Ant_ID) trail from the nest to the food and back. As it follows the path, it continually puts down more Path_Pheromone(Ant_ID) and Path_Pheromone. To avoid loops and cross road issues as described with the Creator ant, the Harvester ant follows the weakest of its pheromone trial.
|Color||Left By||Used By|
|Scout_Pheromone(Ant_ID)||N/A||Scout||Creator with same Ant_ID|
|Path_Pheromone(Ant_ID)||Grey||Follower, Creator, Harvester||Follower with diff Ant_ID, Harvester with same Ant_ID|