How hiteshshaw/trafficweave works
TrafficWeave is a browser-based vehicle-routing optimization simulator. A user selects a city and routing controls in the app; the app initializes graph and solver state, runs an optimizer or tournament, and presents routes, convergence, and benchmark results in map and lab views. The core separates road-path computation, route decoding, and multi-objective scoring from optimization algorithms. The README also describes mapping, algorithm comparisons, and a routing-systems lab. Edges reflect the excerpts, SOURCE INDEX references, or README; some UI-to-subsystem details are necessarily limited by unsampled component bodies.
Main entry points: App.tsx App Controller · benchmarkSuite.ts Benchmark Suite · tournamentRunner.ts Tournament Runner · decoder.ts Route Decoder
Components 29
Application UI
- App Controller
src/App.tsx - Fleet Controls
src/components/FleetControlPanel.tsx - Leaflet Map
src/components/RealLeafletMap.tsx - City Map
src/components/CityMapCanvas.tsx
Road Network
- City Graphs
src/core/graph/graphGenerator.ts - Traffic Engine
src/core/graph/trafficEngine.ts - Shortest Paths
src/core/graph/shortestPath.ts
Optimization Core
- Route Decoder
src/core/formulations/decoder.ts - Cost Evaluator
src/core/formulations/vrpCostEvaluator.ts - Quantum PSO
src/core/algorithms/qpso.ts - Quantum GA
src/core/algorithms/qga.ts - Classical PSO
src/core/algorithms/classicalPso.ts - Classical GA
src/core/algorithms/classicalGa.ts - Simulated Annealing
src/core/algorithms/simulatedAnnealing.ts - Clarke-Wright
src/core/algorithms/clarkeWright.ts - Exact Solver
src/core/algorithms/exactSolver.ts - Tournament Runner
src/core/algorithms/tournamentRunner.ts
Evaluation Labs
- Tournament Arena
src/components/TournamentArena.tsx - Benchmark Suite
src/core/algorithms/benchmarkSuite.ts - Benchmark Lab
src/components/BenchmarkLab.tsx - Scalability Graphs
src/core/graph/scalabilityGraphGen.ts - Quantum Routing Lab
src/components/QuantumInnovationsLab.tsx
Results & Guidance
- Quantum Visualizer
src/components/QuantumVisualizer.tsx - Convergence Chart
src/components/ConvergenceChart.tsx - Theory Guide
src/components/TheoryGuide.tsx - Before & After
src/components/BeforeVsAfterScreen.tsx - Deliverables
src/components/DeliverablesModal.tsx - Sound Effects
src/core/audio/soundEffects.ts
Other components
- Operator
Connections 48
- Operator → App Controller: operates
src/App.tsx - App Controller → City Graphs: initializes graph
src/App.tsx - App Controller → Tournament Arena: renders
src/App.tsx - App Controller → Leaflet Map: renders
src/App.tsx - App Controller → City Map: renders
src/App.tsx - App Controller → Fleet Controls: renders
src/App.tsx - App Controller → Quantum Routing Lab: renders
src/App.tsx - App Controller → Benchmark Lab: renders
src/App.tsx - App Controller → Theory Guide: renders
src/App.tsx - App Controller → Before & After: renders
src/App.tsx - App Controller → Deliverables: renders
src/App.tsx - App Controller → Quantum PSO: constructs solver
src/App.tsx - App Controller → Classical PSO: constructs solver
src/App.tsx - App Controller → Quantum GA: constructs solver
src/App.tsx - App Controller → Classical GA: constructs solver
src/App.tsx - App Controller → Tournament Runner: constructs runner
src/App.tsx - Leaflet Map → Shortest Paths: uses routing
src/components/RealLeafletMap.tsx - Fleet Controls → Cost Evaluator: updates weights
src/components/FleetControlPanel.tsx - Tournament Arena → Tournament Runner: runs
src/components/TournamentArena.tsx - Benchmark Lab → Benchmark Suite: runs trials
src/components/BenchmarkLab.tsx - Benchmark Suite → Quantum PSO: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Quantum GA: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Classical PSO: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Classical GA: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Simulated Annealing: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Clarke-Wright: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Exact Solver: benchmarks
src/core/algorithms/benchmarkSuite.ts - Benchmark Suite → Scalability Graphs: generates stress cases
src/core/algorithms/benchmarkSuite.ts - Tournament Runner → Quantum PSO: dispatches
src/core/algorithms/tournamentRunner.ts - Tournament Runner → Quantum GA: dispatches
src/core/algorithms/tournamentRunner.ts - Tournament Runner → Classical PSO: dispatches
src/core/algorithms/tournamentRunner.ts - Tournament Runner → Classical GA: dispatches
src/core/algorithms/tournamentRunner.ts - Tournament Runner → Simulated Annealing: dispatches
src/core/algorithms/tournamentRunner.ts - Tournament Runner → Clarke-Wright: dispatches
src/core/algorithms/tournamentRunner.ts - Quantum PSO → Route Decoder: decodes positions
src/core/algorithms/qpso.ts - Quantum PSO → Cost Evaluator: scores routes
src/core/algorithms/qpso.ts - Quantum GA → Route Decoder: decodes positions
src/core/algorithms/qga.ts - Quantum GA → Cost Evaluator: scores routes
src/core/algorithms/qga.ts - Route Decoder → Shortest Paths: queries paths
src/core/formulations/decoder.ts - Route Decoder → Exact Solver: computes emissions
src/core/formulations/decoder.ts - Cost Evaluator → Route Decoder: consumes route plan
src/core/formulations/vrpCostEvaluator.ts - Exact Solver → Shortest Paths: builds distance matrix
src/core/algorithms/exactSolver.ts - Exact Solver → Cost Evaluator: evaluates routes
src/core/algorithms/exactSolver.ts - Benchmark Lab → Exact Solver: compares optimum
src/components/BenchmarkLab.tsx - Quantum Visualizer → App Controller: displays state
src/App.tsx - Convergence Chart → App Controller: displays history
src/App.tsx - Quantum Routing Lab → Sound Effects: plays feedback
src/components/QuantumInnovationsLab.tsx - Before & After → Sound Effects: plays feedback
src/components/BeforeVsAfterScreen.tsx