Week 3 Goals
Modify the implementation to allow a variable height terrain for the environment and possibly dynamic terrain. This new method will be tested and compared to the results from the previous method. Any new parameters for this model will be classified and the old parameters will be compared to the new parameters as before.
Week 3 Results
For this last week, I implemented dynamic blockages which also required that I implemented a full-fledge GUI for the ant simulation (see screenshots below) . I choose to use the SDL (simple direct media layer) library for the graphics rendering. Furthermore, I added the ability to pass the adjustable parameters from the command line for testing purposes. Lastly, I modified the ant movement scheme to account for a minor error I discovered.
After finishing the GUI for the simulator, I added dynamic blockages which can be added/removed via the right/left mouse buttons. Because the pheromone evaporation and corresponding ant movements schemes had been added last week, it was fairly straight forward to implement dynamic blockages. It merely required tweaking the pheromone grid to accommodate cells that cannot hold a pheromone scent.
I also decided upon the parameters I would allow the user to adjust from the command line and, in effect, be able to investigate. These parameters are the number of ants, the randomness of ant exploration, the evaporation rate of both the nest and food pheromones, and an additional random seed for the simulator. The only parameter that requires an explanation is the exploration rate. This number represents the number of frames between ants performing a random action. In other words, the ants generally follow a fairly deterministic movement, but every explorationRate frames the ants can perform a more random movement. In an abstract sense, this parameter adjusts the degree of exploration of the search space.
Finally, the previous weeks have used just four directions, up, down, left, and right, for ant movement. This presented a problem due to the fact that this measures the distance between two points as the Manhattan distance which views the diagonal as the same length as the sum of the two legs. In other words, the shortest path does not look like the shortest path. To rectify this problem, I modified the ant movement scheme to allow movement along the diagonal direction, up-left, up-right, down-left, and down-right.
Thus, the final ant movement scheme is as follows: When the ant is searching for food, it chooses a direction randomly weighted by the strength of the pheromone in each direction, except when the exploreFrame is reached, in which case the ant picks the direction randomly. When the ant has food, it moves in the direction of the largest pheromone gradient, except when the exploreFrame is reached, in which case the ant picks the direction randomly weighted by the pheromone strength in each direction.
Ant nest is green,
Food supplies are blue,
Ants are red,
Pheromones are pink,
Ant trails are white