How jaypatel2611/quantum_traffic_route_optimization works
This is a web application for comparing vehicle-routing solutions and their environmental impact on a selected cached road network. The user selects a city and delivery scenario, optionally marks an accident segment, starts a job, watches solver convergence, then reviews route comparisons and green-impact results. The backend derives distance and travel-time matrices, applies stochastic delays, runs OR-Tools and QPSO concurrently, and exposes results and progress. The source excerpts establish these primary connections; some capabilities are evident from the tree and module names but their internal wiring is not sampled.
Main entry points: optimize_router.py Optimization API · App.tsx Screen Router · client.ts API Client · optimization_orchestrator.py Job Orchestrator
Components 22
Scenario UI
- Screen Router
frontend/src/App.tsx - Scenario Setup
frontend/src/screens/SetupScreen.tsx - Live Run
frontend/src/screens/LiveRunScreen.tsx - Route Results
frontend/src/screens/ResultsScreen.tsx - Green Impact
frontend/src/screens/GreenImpactScreen.tsx - App State
frontend/src/state/AppState.tsx - API Client
frontend/src/api/client.ts
HTTP API
- FastAPI App
backend/app/main.py - Scenario API
backend/app/presentation/api/v1/scenario_router.py - Optimization API
backend/app/presentation/api/v1/optimize_router.py - Convergence Stream
backend/app/presentation/sse/convergence_stream.py
Road Network
- Cached Graph Repo
backend/app/infrastructure/geospatial/cached_graph_repository.py - Graph Loader
backend/app/infrastructure/geospatial/osmnx_client.py - Matrix Builder
backend/app/infrastructure/geospatial/distance_matrix_builder.py - Stochastic Delays
backend/app/infrastructure/geospatial/stochastic_delay_injector.py
Optimization
- Job Orchestrator
backend/app/application/services/optimization_orchestrator.py - OR-Tools Solver
backend/app/infrastructure/algorithms/or_tools_baseline.py - QPSO Solver
backend/app/infrastructure/algorithms/qpso_solver.py - Impact Calculator
backend/app/application/services/green_impact_calculator.py - COPERT Model
backend/app/infrastructure/algorithms/copert_model.py
Domain Models
- Route and Node
backend/app/domain/entities/route.py
Other components
- User
Connections 29
- User → Screen Router: uses
- Screen Router → App State: provides state
- Screen Router → Scenario Setup: shows
- Screen Router → Live Run: shows
- Screen Router → Route Results: shows
- Screen Router → Green Impact: shows
- Scenario Setup → API Client: requests scenarios
- Live Run → API Client: starts and streams
- Route Results → API Client: fetches result
- Green Impact → API Client: fetches result
- API Client → Scenario API: HTTP requests
- API Client → Optimization API: HTTP requests
- FastAPI App → Scenario API: mounts router
- FastAPI App → Optimization API: mounts router
- Scenario API → Cached Graph Repo: lists cities and edges
- Optimization API → Cached Graph Repo: builds matrices
- Cached Graph Repo → Graph Loader: loads cached graph
- Cached Graph Repo → Matrix Builder: computes matrices
- Optimization API → Stochastic Delays: adds travel delays
- Optimization API → Job Orchestrator: submits job
- Job Orchestrator → OR-Tools Solver: dispatches comparison
- Job Orchestrator → QPSO Solver: dispatches comparison
- Optimization API → Job Orchestrator: reads job state
- Optimization API → Impact Calculator: computes impact
- Impact Calculator → COPERT Model: emissions model
- Optimization API → Convergence Stream: opens event stream
- Convergence Stream → Job Orchestrator: reads convergence
- OR-Tools Solver → Route and Node: produces routes
- QPSO Solver → Route and Node: produces routes