This is a project done for the course of Distributed Artificial Intelligence (2021-2022) by Prof. Franco Zambonelli at the University of Modena and Reggio Emilia.
This work aims to implement in Net-Logo the Digital Hormone Model (DHM-0) presented in this paper [1] and used to build a swarm of autonomous agents that show capabilities of self-organization and emerging intelligence when interacting with each other in a common environment.
The model mimics the behaviour of cells in various organism. Cells communicate via secreting hormones in the environment that they can also sense. Each cell follows a set of rules that, based on the environment and near hormones values, leads to a particular action. In our case the "cells" are agents (turtles in Net-Logo).
Each agent will do a simple set of actions in a repetitive loop.
- Release hormones in the environment
- Select the action to make
- Simulate the hormones reaction and dissipation
- Repeat to step 1
The agent will emit a set of two hormones in a given radius around itself: an activator A and inhibitor I. The spatial distribution of the concentration C(x,y) hormones around the agent is given by the formulas below and follow a gaussian distribution.
Here the Aa and Ai are called the activator and inhibitor constants respectively. The other parameters are the two sigma of the two gaussian distributions of the activator and inhibitor. In our case the sigma value of the inhibitor is greater than the activator sigma.
We consider the sum of the two hormones for each location and therefore we obtain a sort of "laplacian" curve (see image below).
Each agent will measure the cumulative hormones concentration inside 9 grids (patches) (see image below). The 9 grids are the neighboor 8 and the agent position.
Once the measurements are made, the agent will select one of the nine grids to move to, following the given rules:
- the probability of moving to a given grid is proportional to the concentration of activator hormones A and inversely proportional to that of the inhibitor hormone I
- the sum of all the probabilities is normalized to 1
That means that the agent will move stochastically around the space, following the hormones with a certain probability. If an agent wants to move to a grid where there is already another agent, then the movement will occur to another free neighboor cell.
netlogo.dhm.evaporation.mp4
In this project the hormone diffusion equation were omitted, implementing only the hormone dissipation and reaction.
In each grid (patch) of the environment, all hormones produced by the agents nearby are summed, and after that a dissipation step take place to ensure the hormone value decreases with time if no agent is near. The dissipation rate is controllable via a parameter.
hormones-evaporation.mp4
NOTE: the actual dissipation is computed by the patch agent and not the turtle agent, but this is an implementation detail.
This project requires Net-Logo installed on your machine. After opening the project, you can set the project parameteres and press the button "setup" to confirm them. Then you can start the simulation pressing the "go" button or in a single step-by-step incremental way using the "1-step" button.
The project parameters you can change are:
- num_turtles: number of agents for the simulation
- rate_of_dissipation: rate of evaporation for the hormones in the environment
- hormone_radius: secreted hormone maximum radius around each turtle
- activator_const: amplitude constant for the hormone activator distribution
- inhibitor_const: amplitude constant for the hormone inhibitor distribution
- activator_sigma: standard deviation constant for the hormone activator distribution
- inhibitor_sigma: standard deviation constant for the hormone inhibitor distribution
- explosion_radius: define the maximum explosion radius possible when pressing the explosion button
The inhibitor sigma value must be greater that the activator sigma for simulation purposes. Also if all the activator and inhibitor parameters are equal, there will be an error given the fact that the hormones will cancel out.
Given a sufficient large number of agents in the simulation and an activator/inhibitor balance, the agents will show a self-organization propension and aggregate and distribute in particular patterns.
When two or more agents come close, the will tend to remain aggregated given that the activator hormones will "attract" them in groups.
At the same time the inhibitor hormone will guarantee the non aggregation of groups of agents, "repelling" them in other location.
The rate of dissipation will also affect the simulation making the hormones evaporate more quickly or slowly and making aggregation less or more common.
Finally, the stochastic behaviour will give the swarm of autonomous agents the self-organization and "edge of chaos" characteristics that improve the whole system adaptability. In this way, a single agents doesn't always make the best decision possible but can act randomly with a given probability.
netlogo.dhm.parameters.mod.mp4
Changing the sigma and constants of the activator and inhibitor hormones will make the systems behave in different ways:
- more importance to the activator will tend to make agents aggregate more
- more importance to the inhibitor will tend to make agents aggregate less
- a balanced aggregator/inhibitor importance will make the agents aggregated but not too much, making emerging patterns of local clusters and distributing the agents in the environment.
Changing the rate of dissipation will:
- aggregate more agents if the value is low (hormones tend to remain in the grids)
- aggregate less agents if the value is high (hormones quickly evaporate and disappear)
Changing the number of turtles on a low number will make the emerging self-organization behaviours disappear. Increasing the number of turtles over a certain number will make the self-organization behaviours appear and at that point increasing the number of turtles will not affect greatly the system behaviour.
Lastly, changing the hormone radius will make agents aggregate in space with more or less ease if the value is high or low respectively.
netlogo.dhm.explosions.mp4
Simulating random explosions that will kill the agents in a given radius (from a random patch in the environment) shows interesting results in regards of the self-organization capabilities of the swarm. When an explosions occurs, agents re-organize to fill the new non-occupied spaces, even if the number of turtles is lower than before the damage.
The model can be easily extended changing the hormone distribution model and/or optimizing code to compute it. The stochastic model of behaviour of each agents can be improved to make the agent less or more prone to random choices. Additionally, a propagation model can be implemented to simulate a non instantaneous hormone release in space by the agents, integrating the equation in the paper [1]
To decrease the random behaviour when choosing a direction to take, an exponential function is used to weight more high values of hormones in the patches in the "compute_grid_prob" reporter function.
For the reporter function "sense_and_choose_direction", a particular sets of commands were used:
- a vector containing the hormones values in the neighboor patch was created then normalized to obtain a probability array for each of the 9 possible actions.
- Then to sample and choose the next action, it was necessary to create a cumulative density function table (CDF) and use a random generated number from 0 to 1 to make the sampling.
- After these steps, the next choosen action was reported to the "select_and_perform_action" procedure that will execute the movement only if the selected cell is free of other agents.
A set of code examples for the Net-Logo library were used for reference. In particular, the Ant example under the "Biology" folder from the library was used to see how to implement the hormone evaporation algorithm required for the project.
This work was done by Ettore Candeloro and is under the MIT license, freely available at Git-Hub here
Part of the images and formulas used to explain the project are from the below cited paper. All credits goes to the authors.
[1] Shen, Wei-min & Will, Peter & Galstyan, Aram & Chuong, Cheng-Ming. (2004). Hormone-Inspired Self-Organization and Distributed Control of Robotic Swarms: Special Issue on Analysis and Experiments in Distributed Multi-Robot Systems (Guest Editors: Nikolaos P. Papanikolopoulos and Stergios I. Roumeliotis). Autonomous Robots. 17. 10.1023/B:AURO.0000032940.08116.f1.