Skip to content

feat: implement signal conflict modeling, distance-based noise scaling, and per-agent heterogeneity#42

Merged
stedrew merged 13 commits intodenoslab:mainfrom
legend5teve:feat/visualization-module-plots
Mar 16, 2026
Merged

feat: implement signal conflict modeling, distance-based noise scaling, and per-agent heterogeneity#42
stedrew merged 13 commits intodenoslab:mainfrom
legend5teve:feat/visualization-module-plots

Conversation

@legend5teve
Copy link
Copy Markdown
Collaborator

@legend5teve legend5teve commented Mar 16, 2026

Summary

  • Signal conflict modeling: Added Jensen-Shannon Divergence (JSD) to measure env-social belief conflict, with compute_signal_conflict() in belief model and record_conflict_sample()/compute_average_signal_conflict() in metrics
  • Distance-based noise scaling: Implemented proposal Eq. 1 — effective sigma scales with base_margin / D_ref, so closer fires produce less perceptual noise (inject_signal_noise and sample_environment_signal updated with distance_ref_m parameter)
  • Per-agent parameter heterogeneity: Added sample_profile_params() using truncated normal distributions with hash-based deterministic RNG per agent, controlled via *_SPREAD env vars (all default 0.0 for backward compatibility)
  • Prompt field restructuring: Replaced subjective_information/belief_state with your_observation/neighbor_assessment/information_conflict/combined_belief; fixed stale field reference in scenarios.py
  • Test coverage: Added tests for conflict metrics, distance-based noise scaling, per-agent heterogeneity, and belief model conflict integration (291 tests passing)

Test plan

  • All 291 existing + new tests pass (python -m pytest tests/)
  • Run simulation with DIST_REF_M=500 to verify distance-scaled noise
  • Run simulation with THETA_TRUST_SPREAD=0.15 THETA_R_SPREAD=0.1 to verify agent heterogeneity
  • Verify average_signal_conflict appears in metrics JSON output

🤖 Generated with Claude Code

legend5teve and others added 13 commits March 5, 2026 16:05
 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.
…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 stedrew merged commit 6efd3a8 into denoslab:main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants