Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The Talking Ants Application is an ant simulation implementation which integrates multiple threading mechanisms to measure fairness and performance. In contrast to the purely stygmergy-based interaction between ants, ants in this application can also interact via messages.
The application consists of a two-dimensional grid with an ant nest, randomly distributed food sources and a number of ants. Upon start ants forage for food ('foraging mode'). Once found, they release pheromone and carry their food back to the ant nest ('homing mode'). Once in the nest, they drop the food and continue to forage for food. For routing ants rely on the pheromone surrounding them. In addition, this implementation allows ants to exchange coordinate information if they the meet and are in opposite 'mode' (i.e. foraging vs. homing mode). If successful ants then directly move towards this coordinate without consideration of pheromone during routing. Upon goal fulfillment or exceeding a defined number of steps (e.g. 40 steps), ants fall back to the conventional pheromone-based interaction.
For further conceptual description and implementation purpose (as a fairness benchmark) please refer here, in particular here, Appendix B.
The figure below shows a screenshot of the application. The square in the upper left area represents the ant nest. Ants are black lines. If carrying food they are represented in red. If they follow an exchanged coordinate they are shown as blue squares. Pheromone is indicated by green colour. Food is indicated as red squares.
Necessary software to run it:
Setup instructions for µ² are provided under Getting started.
Application Setup and Use
Install µ² in Eclipse (using the setup instructions mentioned above).
Copy the 'cljScripts' folder contained in the application archive into the Eclipse project.
Copy the 'microapps' folder contained in the application archive into the 'src' folder of the Eclipse project.
Run the Talking Ants Application by using Main.java. Parameterization (Threading mechanism, Number of ants, benchmark duration, ...) is done in this file.
Parameterize the application within the Main.java file and run it (Right-click, select "Run As" --> "Java Application").
Clojure REPL commands available for interactive control at runtime (in the console window of Eclipse) include
- (start) -- starts application execution
- (stop) -- stops application execution
- (pause) -- pauses application execution
- (resume) -- resumes application execution
- (stats) -- prints stats (e.g. duration, number of ant interactions, number of collected foods, ...)
- (stop-talking) -- disables the direct exchange of coordinates (talking) of ants
- (start-talking) -- enables the direct exchange of coordinates (talking) of ants