Make a step to KKW implementing VDR - #17
Open
LdDl wants to merge 20 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WORK IN PROGRES
Removes the unfinished, mis-calibrated KKW (Kerner–Klenov–Wolf ) layer and replaces it with VDR (Velocity-Dependent Randomization) baseline plus the full driver-behaviour machinery (aggression gradient, patience, lane-change safety) that a future KKW layer will build on.
1. VDR
The longitudinal model is now plain NaSch + two-level VDR: a moving-dawdle probability
pand a higher slow-to-start probabilityp0while stopped (p0 ≥ p). This produces the realistic capacity drop / metastability - the foundation KKW is built on.2. Driver style as one continuous gradient
Aggressiveness is now a continuous
aggressive_level = 1 - cooperativity(no longer an enum type). Behaviour presets derivechange_p1(the probability of actually committing an allowed lane change) andlc_cooldownfrom it.3. Cut-in aggressors
New gradient
aggressor_advantage(constant threshold0.8): an aggressive driver cuts in - bypasses the rear-safety gap at intention time and wins a contested cell against any less-aggressive vehicle, forcing it to brake. Applied uniformly across all non-physical conflict rules (merge-lane-change, merge-forward, forward-lane-change, cross-lane-change). Replaces the old coarse "Aggressive-enum vs Cooperative-enum" checks.4. Patience / desperate override (deadlock escape)
A vehicle starved past
patience()(300–700 steps, scaled by cooperativity) forces its way through - it wins any non-physical contested cell. The most-starved vehicle wins, ties broken by lowest id; it never pushes through a physical tail (a body); the one-occupant-per-cell invariant is preserved (claimed-cells + occupancy check + sweep-through clamp).5. Lane-change safety & anti-weaving
Speed-aware rear gap (
rear_safe, using a start-of-step speed snapshot) + front gap (clear_forward) + an incentive gate + a stochastic P1 commit. Plus a per-type reactive lane-change cooldown (timer_reactive_lane_change/lc_cooldown).6. Determinism
Seedable RNG (
MTSC_SEED); all stochastic draws are unconditional and in a fixed per-vehicle order. A* tie-break viatotal_cmp(NaN-safe). The full-tie conflict tie-break went from a coin flip to lowest vehicle id (invariant to participant order). Result: under a fixed seed its runs in a reproducible way.8. Tests
Extensive new coverage: desperate override (across every conflict type), cut-in aggressor (forward and crossing), order-invariance of the lowest-id tie-break, the P1-vs-aggressiveness mapping, and determinism.
References
Cellular-automata traffic model (Keldysh Institute of Applied Mathematics, RAS):