Skip to content
kmoratisPublic

About

Assingment in Agents course, MSc in Web Intelligence (IHU)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Autonomous Traffic Control System — Grid World

Assignment for the course Large-Scale Intelligent Systems (MB202)
MSc in Web Intelligence — International Hellenic University (IHU)

Overview

A multi-agent traffic simulation built in C++ on a procedurally generated 200×200 grid world. Each intersection is controlled by an autonomous traffic light agent. Two agent architectures are implemented and compared:

  • Fixed-Time: switches phase every fixed number of ticks regardless of traffic conditions
  • Queue-Based: adapts phase based on vehicle queue lengths, with an anti-starvation guard

The simulation runs for 7 simulated days with 100,000 residents, 24,000 daily transit vehicles, service vehicles (garbage collection, food delivery), and random events (storms, breakdowns, accidents).

Build

Requirements: C++17 compiler (GCC/MinGW or MSVC), CMake ≥ 3.16

cmake -B build
cmake --build build

Run

All commands are run from inside the build/ directory. A params.txt file must be present there (one is included).

# Both architectures — world 0
./trafficsim.exe 0

# Fixed-Time only
./trafficsim.exe 0 fixed

# Queue-Based only
./trafficsim.exe 0 queue

# Run all 20 worlds sequentially (resumes if interrupted)
./run_all_worlds.sh

# Run in reverse order (for parallel execution)
./run_all_worlds_reverse.sh

The first argument is the world number (0–19). Each world uses a different random seed for procedural generation.

Configuration

Edit build/params.txt to tune traffic light parameters without recompiling:

fixed_phase_duration = 10   # ticks per phase for Fixed-Time (1 tick = 3 sim-seconds)
max_wait_ticks       = 100  # starvation guard for Queue-Based

Output

Path Contents
results/metrics.csv Per-simulation metrics for all runs
results/world_N.txt Verbose log for world N
results/bmp/ BMP visualizations (world 0 only)

Analysis

Statistical analysis (mean, standard deviation) was performed on the exported metrics.csv files using standard Excel formulas.

Metrics

Five metrics are tracked per simulation (spec-defined):

Metric Description
tTime Mean transit travel time
iTime Mean internal travel time (per resident)
tTPL Transit time per unit length
iTPL Internal time per unit length
tFlowDiff Transit flow difference (exited − entered)

About

Assingment in Agents course, MSc in Web Intelligence (IHU)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages