Multi-agent Simulation
A multi-agent system is built from autonomous, asynchronous agents that have their own local goals and can interact with other agents in the shared environment.
Description
Each agent, in this case,
Animal
has a genotype that determines its behavior - the probability of moving in either direction.On each tick of the simulation, each animal makes a move. Moving costs energy. Energy can be acquired by eating plants, that grow in random places on the map. The dark green area (jungle) in the center of the map has a higher probability of growing plants.
When two animals meet on the same field, they can breed, if they both have enough stored energy. The offspring is born with a genotype that is a combination of its parent's genes.
Animals with no energy are considered dead and are removed from the simulation.
Implementation
The simulation is implemented in Java and JavaFX. It's multithreaded and allows running multiple copies with the same starting conditions. Each instance can be paused or can generate a summarized report to a file.
Starting parameters can be set in
parameters.json
:{
"mapDimension" : 100,
"startAnimalNumber" : 100,
"startEnergy" : 200,
"moveEnergy" : 10,
"plantEnergy" : 100,
"newPlants" : 20,
"jungleRatio" : 0.25,
"delay" : 30,
"numberOfSimulations" : 2
}
Animal color changes from yellow to red based on their level of stored energy.
The largest group of animals that share the same genotype is displayed in blue.
You can select any animal to track it and view detailed information about it in the dashboard.