Requirements

For running the examples, the simulations and the chart generation, you need to have the following installed:

  • A valid JDK installation (>= 11)
  • A python installation (>= 3.8)

Running the examples

The examples are located in the src/main/scala/it/unibo/scafi/example folder. Each example has an associated yaml file, which contains the configuration for the Alchemist simulation. In the following we briefly describe how to run each example and what it is the expected result.

For enabling the trace, follow the following video:

Constant movement
Example Description Command
src/main/scala/it/unibo/scafi/examples/ConstantMovement.scala A swarm of agents moving in a straight line ./gradlew runConstantMovementGraphic

Explore
Example Description Command
src/main/scala/it/unibo/scafi/examples/Explore.scala A swarm of agents exploring a fixed area ./gradlew runConstantMovementGraphic

Obstacle Avoidance
Example Description Command
src/main/scala/it/unibo/scafi/examples/ObstacleAvoidance.scala A swarm that try to avoid obstacles ./gradlew runObstacleAvoidanceBigGraphic or ./gradlew runObstacleAvoidanceMiddleGraphic or ./gradlew runObstacleAvoidanceGraphic

Towards Leader
Example Description Command
src/main/scala/it/unibo/scafi/examples/TowardsLeader.scala Nodes go towards a sink point (a leader) ./gradlew runTowardsLeaderGraphic

Spin Around a Leader
Example Description Command
src/main/scala/it/unibo/scafi/examples/BranchingExample.scala Nodes spin aroud a leader ./gradlew runSpinAroundGraphic

Reynolds Flocking
Example Description Command
src/main/scala/it/unibo/scafi/scala/examples/ReynoldFlock.scala Swarm moving following reynolds rule ./gradlew runReynoldFlockGraphic

Team Formation (branching)
Example Description Command
src/main/scala/it/unibo/scafi/scala/examples/BranchingExample.scala Example of team formation through branch `./gradlew runBranchingExampleGraphic`

Team Formation (logical)
Example Description Command
src/main/scala/it/unibo/scafi/scala/examples/TeamFormation.scala A swarm that create several sub-swarm based on spatial constraints ./gradlew runTeamFormationGraphic

Shape Formation
Example Description Command
src/main/scala/it/unibo/scafi/scala/examples/AllShape A swarm of nodes that form several shapes ./gradlew runAllShapeGraphic

For other examples, please refer to the examples folder. For each file, you can run the corresponding example with the following command:

./gradlew run<ExampleName>Graphic

Simulation: Find and Rescue

The focus is on a scenario involving a fleet of drones patrolling a 1 km² area, designed to respond to emergency situations such as fires or injuries. In the following, we describe the main characteristics of the scenario, the simulation parameters, and the expected results.

Scenario Details

  • Environment: A spatial area of 1 km².
  • Emergency Situations: These include events like fires or injuries, and are randomly generated within the simulation.
  • Drone Fleet Composition:
    • Explorers: 50 drones tasked with identifying emergency situations.
    • Healers: 5 drones designated to respond to and resolve emergencies.
  • Operation: Exploration is conducted in groups, each consisting of at least one healer and multiple explorers.
  • Drone Specifications:
    • Speed: Maximum of 20 km/h.
    • Communication Range: 100 meters.
  • Simulation Parameters:
    • Duration: Each run lasts 90 minutes.
    • Emergency Generation: Emergencies occur randomly in a [0, 50] minutes timeframe.
    • Objective: Minimize the number of unresolved emergency situations.

Running the Simulation

To observe the dynamics of the simulation, execute the following command:

./gradlew runRescueGraphic

In the following there is a sequence of screenshots of the simulation:

Further Information

For a comprehensive understanding and additional details, please refer to the accompanying academic paper.

Reproduce the results

To reproduce the results of the paper, you can run the following command:

./gradlew runRescueBatch

This will launch 64 simulations with different seeds. Each of them, will produce a csv file in the data folder. In this repository, the data is already loaded, so you can directly run the following command to generate the plots:

pip install -r requirements.txt
python process.py

This will produce the following charts stored in charts/: