Ants Simulation

by Peter Kuhn, Jannik Luboeinski, Laura Martin, Marius Schneider

Abstract

Our program simulates the behavior of ants trying to find the shortest way to a food source starting from their nest. Therefore, we have used the ant colony optimization algorithm based on the principle that ants drop a certain amount of pheromone, while they return to their nest after having found a food source.
This makes other ants follow their path.

On a long timescale, this leads to emergence of optimal paths because, in average, the shortest way is the most used one. In our simulation, a two-dimensional map containing a nest and several randomly placed food sources can be generated.

The ants start searching for food, performing a random walk. When an ant finds a food source, it walks back the exact way it came, spreading pheromone. Ants starting from the nest now try to follow the pheromone.

Simulation

Key

Map points: Ants:
The pheromone concentration is visualized by colors between yellow (low) and red (high). The food rate shows, how much food is currently collected per second.

The simulation speed can be adjusted via the speed slider, which sets the number of calculation steps (equates to ant steps) per second.

Map points

Every map point contains two attributes: its type (border, nest, food, empty) and its pheromone concentration.
The map we use is created by placing N food sources on the 150 × 100 points map randomly. The nest is set on a map point which is located somewhere in the center of the map. All points on the edges are made border points, which stops the ants from leaving the map.

In the simulation, it is possible to set the type of map points to any of the types mentioned.

Ant types and behavior

We consider four different ant states: seeker, follower returner and returner2. Depending on the pheromone concentration around the nest, the ants spawn as followers or seekers. Therefore, we generate a random integer.
If the pheromone concentration of one map point around the nest is higher than this integer, the ant becomes a follower, otherwise it becomes a seeker.

Pheromone

When a returner drops pheromone, it drops a certain amount of pheromone in the center of its location and some fraction of that amount in a circle around the center. The pheromone drop amount can be set inside the simulation.

In every time step, the pheromone concentration of every map point decreases according to the following formula (depending on a constant k):

C_pheromone(t) = (1-k) C_pheromone(t)

The pheromone decay constant k can be varied inside the simulation as well.

Download

You can download an executable JAR file including the simulation and the Java source code from here: