An advanced AI-powered railway traffic control system that combines Graph Neural Networks (GNN), Reinforcement Learning (RL), and Operations Research (OR) to optimize train scheduling, routing, and real-time decision making for Indian railway networks.
- Graph Neural Networks (GNN): Models complex railway network relationships
- Reinforcement Learning (PPO): Learns optimal policies through simulation
- Operations Research: Validates AI decisions with safety constraints
- Hybrid Decision Making: "AI Proposes, OR Disposes" methodology
- Live Train Tracking: Real-time position and status monitoring
- Dynamic Scheduling: Adaptive scheduling based on current conditions
- Conflict Resolution: Automatic detection and resolution of scheduling conflicts
- Performance Optimization: Speed, fuel efficiency, and delay minimization
- Performance Metrics: On-time performance, throughput, safety violations
- Real-time Dashboard: Web-based monitoring and control interface
- Predictive Analytics: Delay prediction and route optimization
- Data Visualization: Interactive network and performance visualizations
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Web Frontend │ │ Flask API │ │ AI Controller │
│ │◄──►│ │◄──►│ │
│ • Dashboard │ │ • REST Endpoints│ │ • GNN + RL + OR │
│ • Visualization │ │ • Real-time Data│ │ • Decision Engine│
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Railway Env │
│ │
│ • Train Sim │
│ • Network Model │
│ • Physics Engine│
└─────────────────┘
- Python 3.8+
- PyTorch 2.0+
- CUDA (optional, for GPU acceleration)
- Clone the repository
git clone https://github.com/your-username/ai-railway-control.git
cd ai-railway-control- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Run the system
python live_railway_ai_simulation.py- Access the dashboard
http://localhost:5003
ai-railway-control/
├── 📂 src/ # Core source code
│ ├── 🧠 agents/ # RL agents (PPO)
│ ├── 🔗 models/ # GNN and data models
│ ├── 🎮 simulation/ # Railway environment
│ ├── 🔧 integration/ # Data integration
│ └── 🌐 web_interface/ # Web components
├── 📂 configs/ # Configuration files
├── 📂 data/ # Data files (ignored)
├── 📂 models/ # Trained models (ignored)
├── 📂 docs/ # Documentation
├── 📂 tests/ # Test suite
├── 🚄 live_railway_ai_simulation.py # Main application
├── 🎯 train_agent.py # RL training script
├── 🌐 railway_dashboard.py # Web dashboard
└── 📋 requirements.txt # Dependencies
# Start the complete AI system
python live_railway_ai_simulation.py
# Access web dashboard
open http://localhost:5003# Train new RL agent
python train_agent.py --episodes 1000
# Train with hyperparameter tuning
python train_agent.py --tune-hyperparams --tune-trials 20
# Resume training from checkpoint
python train_agent.py --load-model models/checkpoint_500.pt# Launch dashboard only
python railway_dashboard.py
# Launch enhanced GUI
python launch_enhanced_gui.pyGET /api/hybrid-ai-stats- AI system status and performanceGET /api/trains- Current train positions and statusGET /api/stations- Railway network stations
POST /api/emergency-stop- Emergency stop all trainsPOST /api/train/{id}/action- Send action to specific train
# Run all tests
python -m pytest tests/
# Run specific test
python -m pytest tests/test_rl_agent.py
# Run with coverage
python -m pytest --cov=src tests/The system achieves:
- Decision Speed: ~270 decisions/second
- Success Rate: 100% (6,222+ decisions without rejection)
- Response Time: <1.2ms average decision time
- Throughput: 100+ concurrent trains
- Accuracy: Real-time conflict resolution
# Optional configuration
export RAILWAY_ENV=production
export LOG_LEVEL=info
export CUDA_VISIBLE_DEVICES=0configs/default.yaml- Default system configuration- Modify parameters for different scenarios
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Indian Railway network data
- PyTorch Geometric for GNN implementation
- OpenAI Gymnasium for RL environments
- Flask for web framework
- Project Lead: Your Name
- Repository: GitHub
- Issues: Bug Reports
Built with ❤️ for the future of railway transportation