Skip to content

Conversation

@italoamaral-dev
Copy link

Summary

Adds a Solara-based agent-based model example demonstrating ideological diffusion in a population influenced by social interaction and external pressures.

Motive

This example was created to provide a clear and practical reference for users interested in building interactive agent-based models with Mesa and Solara.
During development, some friction was encountered when setting up Solara-based examples, which motivated keeping this model minimal, robust, and easy to run.

Implementation

The model represents individuals placed on a grid, each with an opinion state (neutral, moderate, or radical), as well as individual resistance and susceptibility parameters.
At each step, agents update their opinions based on neighborhood influence and external factors such as economic crisis and propaganda.
A Solara visualization was implemented to allow interactive parameter tuning and real-time visualization of both the spatial distribution of agents and the evolution of opinion counts.

Usage Examples

Run the example with:

solara run app.py

from mesa import Model
from mesa.datacollection import DataCollector
from mesa.space import MultiGrid
from mesa.time import RandomActivation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RandomActivation was removed with Mesa 3

@tpike3
Copy link
Member

tpike3 commented Jan 3, 2026

@italoamaral-dev Thanks for the PR and new example. Beside updating to mesa 3 could you also

  • Take a look at your local imports to ensure they past the tests, please.
  • Add some pics or gif of your model outputs

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