feat: implement signal conflict modeling, distance-based noise scaling, and per-agent heterogeneity#42
Merged
stedrew merged 13 commits intodenoslab:mainfrom Mar 16, 2026
Conversation
Changes to be committed: modified: agentevac/simulation/main.py modified: agentevac/simulation/spawn_events.py modified: agentevac/utils/replay.py modified: sumo/Repaired.netecfg modified: sumo/Repaired.sumocfg
Module updated: agentevac/utils/replay.py
- Fixed RouteReplay._load_schedule(...) so it only reads step and veh_id for replayable events:
- route_change
- departure_release
- Non-replayable events like agent_cognition and metrics_snapshot are now ignored without touching veh_id.
Cause
- The loader was accessing rec["veh_id"] before checking the event type.
- metrics_snapshot records do not have veh_id, so replay loading crashed with KeyError.
Verification
1. python3 -m py_compile agentevac/utils/replay.py passed.
2. Reproduced the failing case with a small local script:
- one route_change
- one agent_cognition
- one metrics_snapshot
- replay load now succeeds and only indexes the route-change step.
…s and agent communication
…t_round_timeline.py
…gs for documentation
…g, and per-agent heterogeneity - Add compute_signal_conflict() using Jensen-Shannon divergence in belief_model.py - Restructure all three LLM prompts (pre-departure, destination, route) to expose raw env vs. social disagreement via your_observation/neighbor_assessment/ information_conflict/combined_belief fields - Add conflict_assessment field to all Pydantic response models - Add conflict recording to metrics (record_conflict_sample, compute_average_signal_conflict) - Implement distance-based noise scaling (proposal Eq. 1): effective sigma scales with fire margin / reference distance via DIST_REF_M config - Add per-agent parameter heterogeneity via sample_profile_params() with truncated normal distributions; configurable via *_SPREAD env vars (default 0 = legacy) - Fix stale subjective_information reference in scenarios.py - Add experiment stage scripts (stages 0-5) for RQ1/RQ2/RQ3 sweeps - Add comprehensive tests for all new features (291 tests passing) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
stedrew
approved these changes
Mar 16, 2026
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.
Summary
compute_signal_conflict()in belief model andrecord_conflict_sample()/compute_average_signal_conflict()in metricsbase_margin / D_ref, so closer fires produce less perceptual noise (inject_signal_noiseandsample_environment_signalupdated withdistance_ref_mparameter)sample_profile_params()using truncated normal distributions with hash-based deterministic RNG per agent, controlled via*_SPREADenv vars (all default 0.0 for backward compatibility)subjective_information/belief_statewithyour_observation/neighbor_assessment/information_conflict/combined_belief; fixed stale field reference inscenarios.pyTest plan
python -m pytest tests/)DIST_REF_M=500to verify distance-scaled noiseTHETA_TRUST_SPREAD=0.15 THETA_R_SPREAD=0.1to verify agent heterogeneityaverage_signal_conflictappears in metrics JSON output🤖 Generated with Claude Code