Roadway Generator

The Roadway Generator creates an idealized luminous intensity distribution for selected roadway scenarios. It applies smooth angular mutations, evaluates candidates in parallel and retains the best distributions. The generator maximizes merit; it does not guarantee a global optimum or a manufacturable optical design.
Scenario And Baseline
Select and check the roadway scenarios that should drive the generator. If an intensity distribution is selected, it is used as the baseline. If none is selected, the tool creates a Lambertian 1000 lm baseline.
Optimization Constraints
- Population: number of candidates in each generation.
- Survival per Round: number of best candidates kept for the next generation.
- Iterations: number of generations to run.
- Symmetry: constrains the generated distribution to no symmetry, bilateral symmetry, or quadrant symmetry.
- C step: angular spacing between Type-C planes (default 5 degrees).
- Gamma steps: separate spacings for 0-50, 50-60 and 60-90 degrees (defaults 10, 5 and 2.5 degrees).
- Mutation radius: configured angular radius of each smooth local change (default 10 degrees), with automatic low-gamma floors described below.
- Initial strength: initial mutation amplitude, adapted during the run according to the proportion of successful candidates (default 25%).
- Seed: controls the repeatable mutation sequence.
- Workers: maximum evaluation threads; 0 selects automatically, limited by available hardware and population size.
The baseline is copied and resampled to a Type-C grid before optimization. The default downward gamma angles are 0, 10, 20, 30, 40, 50, 55, 60, 62.5, ..., 87.5 and 90 degrees. Coarser sampling near nadir limits narrow peaks that would otherwise target individual roadway calculation points. Existing Type-C samples above 90 degrees are retained. Upper-hemisphere samples are not locally mutated, but change with overall flux normalization. The source photometry is not modified.
Every candidate is normalized to 1000 lm. Mutations preserve nonnegative intensity, symmetry, the periodic seam and pole consistency. Paired increases/decreases explore a neighborhood; surviving candidates retain their already calculated scores. Changing the worker count does not change the result for the same inputs, seed and iteration count on the same build. Excessive grid/population sizes and invalid scenario dimensions are rejected before optimization.
Low-Angle Mutation Width
The effective mutation radius depends on its center's gamma angle. For a configured radius r:
| Center gamma | Effective radius |
|---|---|
| 0-35 degrees | max(r, 20) |
| 35-45 degrees | Smooth transition from max(r, 20) to max(r, 10) |
| 45-50 degrees | Smooth transition from max(r, 10) to r |
| 50-90 degrees | r |
Transitions use smoothstep interpolation, s(t) = t*t*(3 - 2*t), with t running from 0 to 1 across each band. These are angular radii, not full cone widths: a 20-degree radius spans a 40-degree cone. The effective radius never falls below the configured value. Smaller configured radii permit sharper features at and above gamma 50 degrees, subject to the sampling grid.
This broadens individual low-angle mutations; it does not filter the resulting distribution or guarantee a minimum final feature width. Overlapping increases and decreases can still form narrower features.
Merit Function
LPS18 Preset
For each scenario, the assessment first determines the luminous flux needed to meet its average luminance/illuminance requirements, retaining a 0.1% margin. Criteria are then assessed at that flux. For a calculated value x and required limit L, the following factors are multiplied:
| Criterion | Merit factor |
|---|---|
| Lav, Eav, Emin | x/L up to the limit; 1 + 0.25*(x/L - 1) above it |
| U0, Ul | min(1, x/L) |
| TI | 1 at or below the limit; exp(-4*(x/L - 1)) above it |
| EIR | max(0, 1 - 2*abs(x - L)) |
Zero minimum requirements contribute 1. A zero TI limit contributes 1 only for zero TI. Each scenario also contributes exp(-min(requiredFlux/1000, 100)), rewarding lower required flux, and a factor of 2 when all its assessed elements pass (otherwise 1). Factors from all checked scenarios are multiplied. Invalid or non-finite candidate results are not eligible for selection.
The combined preset merit is additionally multiplied by 0.05 for luminous intensity class G=0, 0.85 for G=1, and 1.0 for G=2 through G=6. This factor applies once per candidate, irrespective of scenario count. The classification is refreshed after every mutation using the same G-class calculation as the photometry reports (G, not G-star). It penalizes excessive high-angle intensity without making a lower class an absolute rejection.
Quick Roadway is reserved for future implementation and is disabled.
For each luminance-based element report, LPS18 also multiplies by horizontal illuminance uniformity, Ehmin/Ehmax. Ehmin, Ehmax and Ehavg are the minimum, maximum and arithmetic-mean horizontal illuminance in lux over that element's carriageway grid points. Each point is counted once, independently of observer count; separate edge-strip and TI points are excluded. The statistics come from the assessment at the required luminous flux, and their ratio is unaffected by uniform flux scaling.
A uniform illuminated grid contributes 1; increasing the contrast between bright and dark points reduces the factor. Factors multiply across all selected luminance-based element reports. A dark grid (Ehmax <= 1e-9 lx) contributes zero, and invalid or incomplete statistics reject the candidate. C/P-class reports do not receive this additional factor. These statistics are optimization diagnostics, not additional EN13201 compliance requirements: they do not change PASS/FAIL or required-flux scaling and are hidden from the calculator's compliance table.
Equation Defined
The table identifies each scenario, element and criterion, assigning parameters t1, t2, and so on. A minimum luminous flux parameter follows each scenario's criteria. Scenario and element cells are merged by their actual identities, including when names are repeated.
The Photometry / Luminous intensity class (G) parameter exposes the candidate's integer class from 0 to 6 after the existing scenario requirement and minimum-flux parameters. Horizontal illuminance diagnostics are appended after G class, in scenario/element order, as Ehmin, Ehmax, Ehavg. Existing parameter numbers remain unchanged. For a single M-class scenario with five criteria, minimum flux remains t6, G class remains t7, and the new diagnostics are t8, t9, t10. For example, (t2*t3/t4/t6)*(t8/t9) adds horizontal uniformity to that existing custom merit. Custom equations must explicitly use these parameters; preset multipliers are not applied automatically.
The entered expression is evaluated directly using TinyExpr. Arithmetic +, -, *, /, %, ^, parentheses and functions such as sqrt, abs, exp, ln, log10, sin and cos are supported. Trigonometric arguments are radians. With the bundled parser's default rules, exponentiation is left-associative and unary signs bind before powers; use explicit parentheses for clarity. For example, use t2*t3/t4/t6 only when those parameters have the intended meaning in the current table. Parameters can change when scenarios are checked or reordered; the expression is preserved, so review its mapping after such changes.
Equation mode replaces the preset merit entirely: flux and PASS bonuses are not implicitly added. Unknown parameters and syntax errors prevent starting. Division by zero and other non-finite results reject the candidate; an invalid baseline result stops the run with a diagnostic.
Run Controls
Run starts optimization using a snapshot of the baseline, checked scenarios and settings. These controls are locked during the run. Pause/Continue pauses between evaluations and stores an interim result when available. Stop cancels a paused run. The chart periodically plots the best merit over the optimization history. Closing the page cancels and joins its background work safely.
Output
When optimization finishes, the generated intensity distribution is added to the open project as a new photometry. Trial evaluations refresh luminous flux, intensity maxima and application classifications without recalculating unrelated reports; published results receive the full photometric recalculation. Verify the final distribution against the intended scenarios before using it for optical design.