Skip to content

Code Repo for using LLM as individual decision-maker for flocking

License

Notifications You must be signed in to change notification settings

Zhourobotics/llms-for-flocking-pub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Challenges Faced by Large Language Models in
Solving Multi-Agent Flocking

This repository contains our implementation of our papers flocking simulation.

DARS2024_LLM_video_slide_v2_cmp.mp4

Alternative address: https://www.youtube.com/watch?v=Oqa_F1TSitc

Prerequisites

  • Make sure you have Python installed
  • This project has a few dependencies, install them with pip install -r requirements.txt
  • You'll also need one or more valid OpenAI API keys. When you have them in hand, create a file titled secrets.yml and add them in the following format:
    api_keys:
        0: "sk-YourFirstAPIKeyHere"
        1: "sk-YourSecondAPIKeyHere"
        2: "sk-YourThirdAPIKeyHere"

Usage

usage: main.py --mode {run, plot} --name TEST_NAME
               [--agents AMOUNT_OF_AGENTS] [--rounds AMOUNT_OF_ROUNDS]
               [--seed RANDOM_SEED] 
               [--prompt PROMPT]
               [--round_description ROUND_DESCRIPTION]
               [--spawn_x_min SPAWN_X_MIN] [--spawn_x_max SPAWN_X_MAX]
               [--spawn_y_min SPAWN_Y_MIN] [--spawn_y_max SPAWN_Y_MAX]
               [--model GPT_MODEL] [--memory_limit MEMORY_LIMIT]
               [--x_min X_MIN] [--x_max X_MAX] [--x_ticks X_TICKS]
               [--y_min Y_MIN] [--y_max Y_MAX]

Example

example: main.py --mode run --name mytest 
                 -a 3 -t 15
                 -s 42
                 -p "Your position is: [{}]. There are other drones in this space and their positions (in the format [[x, y], [x, y]...]) are: [{}]. Your task is to collectively implement a flocking behavior. Attempt to match the velocity of nearby agents and adjust your movement to align with this average direction. If you are not near any other agents, move towards the center of mass of nearby agents to stay close to the group. Calculate the distance between yourself and other agents. If any agent is closer than 4 units, you MUST move away to maintain personal space. It is critical you maintain a distance between drones. If you are close to any other drones you MUST move away, otherwise you fail the task."
                 -r "Your position is: [{}]. The positions of the other drones (in the format [[x, y], [x, y]...]) are: [{}]. Pick a position to move to, and briefly explain the reasoning behind your decision."
                 --x_min -10 --x_max 30 --x_ticks 5 --y_min 0 --y_max 20

With any questions about the code, please get in touch with Peihan Li at pl525(at)drexel.edu

About

Code Repo for using LLM as individual decision-maker for flocking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages