Minimal agent-based models of consensus formation and collective dynamics.
This repository investigates how global consensus can emerge from simple local interactions between agents.
The model explores a minimal mechanism:
local interaction → domain formation → global consensus
Agents interact on a two-dimensional lattice and iteratively update their opinions according to local neighborhood dynamics.
The project is part of the broader Meccanismo Complesso research initiative on:
- complex systems
- emergence
- collective behavior
- agent-based modeling
- networked dynamics
Many collective systems exhibit spontaneous organization despite the absence of centralized coordination.
Examples include:
- opinion formation
- cultural diffusion
- social coordination
- collective decision-making
- biological self-organization
This repository studies whether large-scale consensus can emerge from:
- purely local interactions
- stochastic dynamics
- minimal behavioral assumptions
without requiring optimization, planning, or intelligent coordination.
Agents occupy a two-dimensional periodic lattice.
Each agent holds a binary opinion:
+1-1
At each time step:
- Agents observe neighboring opinions
- A local majority is computed
- Agents adopt the local majority with probability
conformity - With small probability
noise, opinions randomly flip
The system therefore combines:
- local conformity
- stochastic perturbations
- emergent collective organization
consensus-emergence/
│
├── README.md
├── requirements.txt
├── .gitignore
│
├── src/
│ ├── agents.py
│ ├── network.py
│ ├── simulation.py
│ └── metrics.py
│
├── scripts/
│ ├── run_simulation.py
│ ├── analyze.py
│ └── visualize.py
│
└── figures/
The repository computes several observables:
Measures global consensus:
M = |<s_i>|
M = 0→ disordered stateM = 1→ full consensus
Measures coexistence of opposing opinions.
High polarization indicates persistent disagreement.
Measures how rapidly the system converges toward consensus.
Install dependencies:
pip install -r requirements.txtGenerate simulation data:
python scripts/run_simulation.pyAnalyze metrics:
python scripts/analyze.pyGenerate visualizations:
python scripts/visualize.pyThe order parameter rapidly increases while polarization collapses, indicating spontaneous consensus formation.
Snapshots of the spatial opinion configuration over time.
The system evolves from random initial conditions toward near-complete consensus.
The results demonstrate that:
- large-scale consensus can emerge from local interactions
- centralized coordination is not required
- stochastic systems can self-organize into ordered states
- minimal behavioral assumptions are sufficient to generate collective structure
The model therefore provides a simple example of emergent organization in complex adaptive systems.
-
Castellano, C., Fortunato, S., & Loreto, V. (2009).
Statistical physics of social dynamics.
Reviews of Modern Physics, 81(2), 591–646. -
Vicsek, T., & Zafeiris, A. (2012).
Collective motion.
Physics Reports, 517(3–4), 71–140. -
Holland, J. H. (1998).
Emergence: From Chaos to Order.
Oxford University Press. -
Mitchell, M. (2009).
Complexity: A Guided Tour.
Oxford University Press. -
Bonabeau, E. (2002).
Agent-Based Modeling: Methods and Techniques for Simulating Human Systems.
Proceedings of the National Academy of Sciences, 99, 7280–7287. -
Axelrod, R. (1997).
The dissemination of culture: A model with local convergence and global polarization.
Journal of Conflict Resolution, 41(2), 203–226.
- Complex Systems
- Agent-Based Modeling
- Consensus Formation
- Collective Dynamics
- Emergence
- Statistical Physics
- Opinion Dynamics
- Self-Organization
Meccanismo Complesso
Independent research initiative on complex systems, emergence, and agent-based dynamics.

