Add Deffuant–Weisbuch bounded confidence model example #303
+338
−0
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.
Closes #300
This pull request adds a new example implementing the Deffuant–Weisbuch bounded confidence opinion dynamics model to the
mesa-examplesrepository.Model Description
The Deffuant–Weisbuch model studies how individual opinions evolve through repeated pairwise interactions in a population where agents are only willing to adjust their views toward others whose opinions are sufficiently close to their own. Over time, these bounded interactions can lead to emergent phenomena such as consensus, polarization, or fragmentation into stable opinion clusters, depending on the confidence threshold and convergence rate.
Motivation
This example serves as a clear and accessible reference for understanding population-level opinion dynamics under bounded confidence assumptions. It is intended to help new Mesa users learn how conditional pairwise interactions, continuous agent attributes, and data collection can be implemented within the Mesa framework.
Implementation
The model simulates a well-mixed population of agents with continuous opinion values evolving through repeated pairwise interactions.
Model Structure
DeffuantWeisbuchModel (
examples/deffuant_weisbuch/model.py)OpinionAgent (
examples/deffuant_weisbuch/agents.py)Visualization (
examples/deffuant_weisbuch/app.py)Usage
To run the example:
What this PR includes
This model is drawn from the bounded confidence opinion dynamics framework introduced by Deffuant et al. (2000).
Happy to contribute! and open to any feedback or suggestions.