This project simulates human daily mobility using LLM (Large Language Model) for activity generation.
The simulation creates realistic daily activity schedules and travel patterns for virtual personas. It uses LLMs to generate activities based on demographic information, and then plans their movements through space and time. Demo here🤗
- Person-centric simulation with demographic attributes and historical mobility patterns
- LLM-based activity scheduling and destination selection
- Realistic travel patterns with various transportation modes
main.py
: Main entry point for the simulationconfig.py
: Configuration settings and prompt templatespersona.py
: Persona class representing individualsactivity.py
: Activity generation using LLMsdestination.py
: Destination selection for activitiesmemory.py
: Recording and tracking mobility patternsutils.py
: Helper functions for calculations and visualizationdata/
: Contains persona definitions and simulation results
- Set up your
.env
file with API keys:
DEEPBRICKS_API_KEY=your_openai_api_key
DEEPBRICKS_BASE_URL=https://api.openai.com/v1
- Chicago travel data in
data/....csv
data/gps_place.csv
mobility historydata/household.csv
houshold incomedata/location_new.csv
location types (updated)data/person.csv
demographic attribute
- Run the simulation:
python main.py
- View results in the
data/results/
directory
See requirements.txt
for dependencies. Main requirements:
- Python 3.8+
- OpenAI API (or compatible)
- GeoPy
- Matplotlib
- Pandas
You can modify simulation parameters in config.py
:
- Number of days to simulate (def=7days)
- Number of days to memory (def=2days)
- LLM model settings (model, maxtoken, temprature)
- Prompt templates (IMPORTANT)
- Construct the evaluation metric (IMPORTANT)
- Compare to different model (Statistic Distribution)
- Add green exposure calculation (shp file need)
- Writing paper (ASAP)