Skip to content

wecracy/space-simulator-rl

 
 

Repository files navigation

SPACE (Swarm Planning And Control Evaluation) Simulator

SPACE Simulator is a pygame-based application for simulating decentralized agent behavior using behavior trees. By integrating your custom decision-making algorithms as plugins, SPACE enables rigorous testing and comparative analysis against pre-existing algorithms.

The official documentation of the SPACE simulator is available at http://space-simulator.rtfd.io/.

GIF GIF
  • Example: (Left) num_agents = 100, num_tasks = 300; (Right) num_agents = 1000, num_tasks = 3000
GIF GIF
  • Example: (Left) GRAPE; (Right) CBBA; (Common) num_agents = 30, num_tasks = 200 (static); 50 x 3 times (dynamic)

Features

  • Simulates multiple agents performing tasks
  • Agents use behavior trees for decision-making
  • Real-time task assignment and execution
  • Debug mode for visualizing agent behavior

Installation

  1. Clone the repository:

    git clone https://github.com/inmo-jang/space-simulator.git
    cd space-simulator
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Run the simulator:

    python main.py

Configuration

Modify the config.yaml file to adjust simulation parameters:

  • Number of agents and tasks
  • Screen dimensions
  • Agent behavior parameters

Refer to the configuration guide CONFIG_GUIDE.md

Usage

Controls

  • ESC or Q: Quit the simulation
  • P: Pause/unpause the simulation
  • R: Start/stop recording the simulation as a GIF file

Monte Carlo Analysis

  1. Set mc_runner.yaml for your purpose and run the following:

    python mc_runner.py
  2. Set mc_comparison.yaml and run the following:

    python mc_analyzer.py

Code Structure

  • main.py: Entry point of the simulation, initializes pygame and manages the main game loop.
  • /modules/
    • agent.py: Defines the Agent class and manages agent behavior.
    • task.py: Defines the Task class and manages task behavior.
    • behavior_tree.py: Implements behavior tree nodes and execution logic.
    • utils.py: Utility functions and configuration loading.
  • /plugins/
    • my_decision_making_plugin.py: Template for decision-making algorithms for each agent.

Contributing

Feel free to fork the repository and submit pull requests. Refer to TODO.md for a list of pending tasks and upcoming features.

Citations

Please cite this work in your papers!

License

GNU GPLv3

About

SPACE (Swarm Planning And Contorl Evaluation) Simulator

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%