An implementation of the Controlled Optimization of Phases (COP) algorithm based on Sen & Head's work on traffic signal optimization. This implementation uses Dynamic Programming (DP) to optimize traffic signal timing plans.
This project implements a traffic signal control algorithm that optimizes signal timing based on various performance criteria:
- Queue length minimization
- Stop minimization
- Delay minimization
The algorithm uses dynamic programming to find optimal green times for each phase while considering:
- Vehicle arrivals
- Queue formation and discharge
- Phase sequencing
- Red clearance intervals
- Minimum and maximum green times
cop97/
├── src/ # Source code
├── data/ # Input data files
├── scripts/ # Shell scripts
├── docs/ # Documentation
└── tests/ # Test files
src/main.cpp: The primary implementation file- Multiple version iterations (
v0throughv5) insrc/ - Shell scripts for execution and testing in
scripts/ - Test data files in
data/
The implementation can optimize for different objectives:
- QUEUES: Minimizes maximum queue length across all approaches
- STOPS: Minimizes total number of vehicle stops
- DELAY: Minimizes total vehicle delay
- Dynamic Programming approach for phase optimization
- Flexible performance criteria selection
- Consideration of queue discharge rates
- Integration of vehicle arrival data
- Support for multiple phases
- Red clearance time handling
- C++ compiler
- CMake 3.10 or higher
- Shell environment for running test scripts
mkdir build
cd build
cmake ..
make./build/cop97./scripts/run.sh # Basic execution
./scripts/parallel.sh # Parallel executionThe program expects traffic data files in the data/ directory:
data0.txtdata1.txtdata2.txtdataZ.txt
The COP algorithm works through the following steps:
- Initialize state variables and value function matrix
- For each stage (phase):
- Calculate feasible green times
- Evaluate performance measures for each decision
- Update value function
- Store optimal decisions
- Continue until convergence or maximum stages reached
Key optimization features:
- Queue length minimization
- Stop minimization
- Delay minimization
- Dynamic Programming approach
- Multiple optimization criteria
- Queue discharge consideration
- Vehicle arrival integration
- Multi-phase support
- Red clearance handling
Based on the seminal work: Sen, S., & Head, K. L. (1997). Controlled Optimization of Phases at an Intersection. Transportation Science, 31(1), 5-17.
Original authors retain their copyright. This implementation is for academic and research purposes.
This is a research implementation and should be considered experimental. Testing and validation are ongoing.