mesa-examples icon indicating copy to clipboard operation
mesa-examples copied to clipboard

Extend Emperor's Dilemma with WhistleblowerAgent and belief gap metric

Open TheMS1314 opened this issue 8 months ago • 0 comments

Summary

Extends the existing Emperor's Dilemma model with three additions:

WhistleblowerAgent — a new agent subclass immune to social pressure that always acts on private belief publicly, regardless of neighbour enforcement. Implemented as a clean subclass of EmperorAgent.

Belief Gap metric — tracks the average distance between private belief and public behaviour across all agents at each step. Measures the illusion of consensus directly.

Norm collapse detection — records the exact step when compliance first drops below 50% via model.collapse_step.

Setting fraction_whistleblowers=0.0 reproduces the original model exactly.

Key finding

There is a sharp tipping point between 5-10% whistleblowers. Below this threshold, the norm holds completely. Above it, the norm collapses rapidly. This threshold behaviour emerges from local interaction rules, not from anything explicitly programmed.

Changes

  • agents.py — added WhistleblowerAgent subclass and belief_gap property
  • model.py — added fraction_whistleblowers parameter, Belief Gap, and Whistleblowers Defying metrics, collapse_step tracking
  • app.py — added whistleblower slider, second chart for belief gap, red color for whistleblower agents
  • README.md — added extensions section documenting the new additions

GSoC contributor checklist

Context & motivation

I got drawn into the Emperor's Dilemma model because it connects to something I think about philosophically — how societies end up loudly defending things nobody actually believes in. The model formalizes that intuition. I wanted to extend it in a way that asks a concrete question: What actually breaks the trap? The whistleblower agent is my answer to that question.

What I learned

The most surprising thing was the sharp tipping point behaviour — at 2% Whistleblowers, the norm holds completely, at 10% it collapses entirely. That threshold behaviour wasn't designed in; it emerged from the local interaction rules. I also learned why relative imports break with solara run directly and how to fix it. That took longer than expected.

Learning repo

🔗 My learning repo: https://github.com/TheMS1314/GSOC_Learning_space 🔗 Relevant model: https://github.com/TheMS1314/GSOC_Learning_space/tree/main/models/emperor_dilemma

Readiness checks

  • [x] This PR addresses an agreed-upon problem (linked issue or discussion with maintainer approval), or is a small/trivial fix
  • [x] I have read the contributing guide and deprecation policy
  • [x] I have performed a self-review
  • [ ] Another GSoC contributor has reviewed this PR: (pending)
  • [x] Tests pass locally
  • [x] Code is formatted (ruff check . --fix)
  • [x] Documentation updated

TheMS1314 avatar Mar 26 '26 20:03 TheMS1314