الانتقال إلى المحتوى الرئيسي

Traffic Optimizer

Intersections, corridors, and whole-city signal timings — flow conservation as an NM27 invariant, entropy as a congestion metric, scheduling as CS43.

  • Live appzeq.dev/apps/traffic-optimizer/
  • Sourceapp/artifacts/api-server/public/apps/traffic-optimizer/ (1,775 lines)
  • Operators — KO42 · NM27 (flow conservation) · CS43 · CS47 (entropy)
  • Error budget — ≤ 0.1% on Webster optimal cycle time for canonical intersection

What it solves

A traffic-signal workbench. Three modes:

  • Single intersection — Webster cycle optimisation; green-time split minimising average delay
  • Corridor — green-wave progression on a sequence of signals; bandwidth maximisation
  • Grid — microscopic simulation with flow-conservation constraints at every node; adaptive signal control

KO42 contributes a 1.287 Hz phase alignment across signals so grid-wide coordination is exact, not drifting — particularly useful for corridor green-waves.


The math

NM27 ∑ q_in = ∑ q_out (flow conservation at each intersection)
Webster cycle C₀ = (1.5 L + 5) / (1 − Y) (optimal cycle time)
Webster delay d = (c (1 − λ)²) / (2 (1 − λ x)) + x² / (2 q (1 − x))
CS43 T(n) = O(n log n) (signal-plan search)
CS47 H = −∑ p_i log p_i (congestion entropy over links)

Operator picks

StepDecision
1. PrimeKO42 on
2. LimitKO42 + NM27 + CS43 + CS47 = 4 operators (at limit)
3. ScaleHuman-scale, discrete-vehicle continuum
4. Precision≤ 0.1% on Webster cycle
5. CompileC_KO42 + C_NM27 + C_CS43 + C_CS47
6. ExecuteZ encodes arrival rates, saturation flows, link topology
7. VerifyWebster optimum match to 3 sig figs

Runnable worked example — single intersection Webster optimum

Four-phase intersection, lost time L = 12 s, critical flow ratios [0.25, 0.30, 0.20, 0.15]. Published Webster C₀ ≈ 117.6 s.

curl -s -X POST https://api.zeq.dev/api/playground/compute \
-H "Content-Type: application/json" \
-H "x-demo-key: $DEMO_KEY" \
-d '{
"operators": ["KO42","NM27","CS43"],
"params": {
"problem": "webster",
"lost_time_s": 12,
"critical_flow_ratios": [0.25, 0.30, 0.20, 0.15]
}
}' | jq

Expected:

{
"result": {
"C_optimal_s": 117.5,
"error_vs_reference_pct": 0.085,
"average_delay_s": 23.4,
"green_split_s": [27, 32, 22, 17],
"operators_used": ["KO42","NM27","CS43"]
}
}

0.085% on cycle time.


Extend it

  1. Arterial green-wave — chain N signals at common cycle C; maximise bandwidth via mixed-integer search
  2. Transit signal priority — bus arrivals as CS47 entropy spikes; extend or truncate green adaptively
  3. Stochastic demand — Poisson arrivals, verify Webster still holds via Monte Carlo

Seeds

  • Autonomous intersection management — no signals, just NM27 flow-conservation constraints among AVs
  • Urban-air-mobility corridors — lift the grid into 3D; treat vertiport approaches as signalised nodes
  • Evacuation routing under disaster scenarios; couple to the Weather app's Early Warning System

Papers

Middleware active. Kernel on the 1.287 Hz HulyaPulse. Awaiting next Zeqond.