This project is the simulation of a crowd passing the narrow way. The implementation is based on Social Force Model presented in 1998. The model is modified by implementing heuristics that modify the behavior of each agent. The following screenshots present the application layout.
The configuration window:
The simulation window:
This project is made to test crowd behavior in stressful situations such as evacuations, fires, or floods.
The application is almost completely finished. There are written tests for each math function and the whole system is well-tested so there is a low probability that any bugs still exist. The only thing that may be improved/implemented is:
- the application visualizer class which may change the agent color accordingly to the pressure put on one (it is marked by the proper todo in the code)
This project uses:
- Java 17
- JavaFX 19.0.2.1
- JUnit 5.9.2
The implemented model is based on the following articles:
- How simple rules determine pedestrian behavior and crowd disasters
- Understanding Social-Force Model in Psychological Principles of Collective Behavior
- Social Force Model for Pedestrian Dynamics
- Deep Social Force
The simulation work is shown below screenshots
1st situation:
2nd situation:
The application architecture was designed to be as flexible as possible. Its design allows the user to turn off and on the heuristics and to change the calculation engine during the work. Possible calculation engines are SingleThread and MultiThreadPoolBased. Moreover, the design allows to implementation of other custom heuristics or calculation engines without modifying the application core. To sum up, the key features of this project are:
- the ease of modifying the heuristics and calculation engine during the work
- the ease of adding/modifying new heuristics or calculation engines
- the physical model may also be easily changed
- the application map and agents placement may be changed by implementing the proper initializer interfaces
All of that is to achived by the design presented on the below simplified UML diagram:
To install the application please follow the below steps:
- Clone the repository
mkdir crowd-pressure
cd crowd-pressure
git clone https://github.com/kbarszczak/Crowd_pressure .
- Install all dependencies
cd Crowd_pressure
mvn clean install
- Run the jar file
java -jar target/CrowdPressureSimulation.jar
Since now the application should launch and the configuration window should be displayed.
Before the installation, one may implement custom initializers for both the map and the agents to run the simulation in the tested environment. If you are not interested in implementing custom initializes you may use those already implemented. Once the application is launched set up the following:
- the agent count (this is the number of all the agents present in the simulation)
- scale coefficient (this is the coefficient applied to the physical calculation. The bigger the number the more the physical impact is)
- destination radius (this is the radius of the circle that the agents are trying to reach)
- delay in ms (since the simulation world is discrete the ticking time has to be specified. The lower the number the more precise the simulation is)
- computation engine (it specifies whether the simulation runs on the single-thread or multi-thread engine)
- map (this changes the simulation environment)
After the setup process, run the simulation by pushing the start button.
- clone the repository
- either make the changes or implement todos
- create the pull request with a detailed description of your changes