"""Short explanations for the public page: one collapsible "Explain" block per section. Direct and concise by request. Numbers are filled in from the current results. site_page.py inserts each block under its heading. """ EXPLAIN = { "summary": """

Question: can the four lights on Big Bend Blvd be timed so drivers wait less at evening rush hour?

Split: Michael + Noah build the math model and optimizer. Gabriel + Diego get real data, simulate the street, and test every timing.

Delay = total time all drivers lose at the lights in one hour (veh-h/h). Today's County timing: {cur:.0f}. Best found: {sl:.0f}.

Status: data, simulation and tests done. Report and the group's own optimizer still to come.

""", "1": """

The four intersections we study, the traffic at each, and the distance between them.

Lights this close affect each other: timed well, cars from one light arrive on green at the next.

Terms: NB/SB/EB/WB = northbound/southbound/eastbound/westbound. Approach = traffic arriving from one direction. τ = drive time between lights.

""", "2": """

The County emailed one document per light: the light's timing settings and hand-counted traffic (direction and turn of every car).

Scanned count sheets were typed in, then checked by program against the sheet totals. Everything matched.

Every number is tagged measured (real source), derived (calculated from measured) or assumed (textbook value).

Terms: L/T/R = share turning left/straight/right. Cycle = one full round of a light (120 s here). Split = seconds a phase gets. Offset = how the lights' cycles are staggered. Lost time = seconds per cycle spent on yellow and all-red.

""", "3": """

Workflow:

  1. Read and check the County documents.
  2. Build one data file, every number tagged with its source.
  3. Give the math team its input.
  4. Build the virtual street (lights, lanes, distances, speed limits).
  5. Add traffic matching the real counts.
  6. Prepare timing plans: County, textbook methods, optimized.
  7. Simulate each plan; measure delay.
  8. Check the simulation against the counts.
  9. Produce tables, charts and this site.

One command reruns all of it (~2 min).

Model: chooses cycle length, Big Bend's green time, and offsets to minimize total delay, within limits (60–150 s cycle, minimum green, no road over 90% full). Michael + Noah's part.

Simulation: SUMO, a traffic simulator that moves every car individually. Each plan runs 10 times (random arrivals) and is averaged; 15 min warm-up, then one measured hour. Lights run the County's real sequence including left arrows; right turn on red allowed; small flows between lights stand in for side streets.

Where it runs: Gabriel's laptop (pipeline/ folder). This site only displays results.

""", "4": """

Simulated car counts vs the County's real counts.

The test is the six points between lights, where the simulation must produce the right traffic on its own.

Result: {ok} of {n_inter} match (GEH under 5, the standard threshold). The simulation reproduces the real street.

""", "5": """

Every timing plan, ranked by delay.

Columns: vs County = % change from today (negative is better). Stops/veh = average stops per car. Throughput = cars served (same for all plans, so the comparison is fair).

Result: the model's timing cuts delay {pct_fo:.0f}% vs today. Provisional until Michael + Noah's code is plugged in.

""", "6": """

Two ways to find a timing: the formula (~1 s, simplified) vs searching inside the simulation (~7 min, realistic).

Left chart: 30 random timings. If the formula judged like the simulation, the dots would form a rising line. They don't (Spearman {rho:.2f}; 1 = perfect agreement).

Right chart: the simulation search improving, then levelling off.

Result: the formula gets close fast but can't reliably rank timings. Simulation search finds ~5% better timings at ~300× the compute.

""", "7": """

The files passed between our part and Michael + Noah's: we send traffic data; they send back timings; we simulate them.

If their format differs, one small file changes.

""", "8": """

Choices that affect the report's claims. The group should agree.

  1. Real lost time and capacity (21–27 s per cycle, from the County's sequence) fed to the model. Needed for its timings to work. Michael + Noah to approve.
  2. Left-turn arrows: all four real lights have them. Revisit "future work".
  3. Simplified virtual street: the full map jammed the simulation; we built a clean one from real distances and lanes.
  4. Assumptions where nothing was measured (e.g. left-turn lane length), all labelled.
""", "9": """

Done: data, simulation, testing, Study 1.

Open: Michael + Noah's optimizer, group sign-off on section 8, our report sections, final report and submission.

""", "10": """

The commands the grader uses to rerun everything from the original County documents.

Appendix: the source of every number (measured / derived / assumed, with evidence).

""", } def block(key, **vals): return ('
Explain this section
' + EXPLAIN[key].format(**vals) + "
")