GithubHelp home page GithubHelp logo

opinion-dynamics-abm's Introduction

Opinion Dynamics

This is a cellular automaton model where each agent lives in a cell on a 2D grid, and never moves.

An agent's state represents its "opinion" and is shown by the color of the cell the agent lives in. Each color represents an opinion - there are 16 of them. At each time step, an agent's opinion is influenced by that of its neighbors, and changes to the most common one found; ties are randomly arbitrated. As an agent adapts its thinking to that of its neighbors, the cell color changes.

Parameters you can play with

(you must change the code to alter the parameters at this stage)

  • Vary the number of opinions.
  • Vary the size of the grid
  • Change the grid from fixed borders to a torus continuum

Observe

  • how groups of like minded agents form and evolve
  • how sometimes a single opinion prevails
  • how some minority or fragmented opinions rapidly disappear

How to Run

To run the model interactively, run run.py in this directory. e.g.

    $ python run.py

Then open your browser to http://127.0.0.1:8521/ and press Reset, then Run.

Files

  • color_patches/model.py: Defines the cell and model classes. The cell class governs each cell's behavior. The model class itself controls the lattice on which the cells live and interact.
  • color_patches/server.py: Defines an interactive visualization.
  • run.py: Launches an interactive visualization

Credits

All credits go to Project Mesa for developing this model.

Further Reading

Inspired from this model from San Jose University
Other similar models: Schelling Segregation Model

opinion-dynamics-abm's People

Contributors

shrutiappiah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

opinion-dynamics-abm's Issues

I got run.py problem

When I type python run.py
It recall:

Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from color_patches.server import server
  File "/mnt/e/001Code/Python/ABM/Opinion-Dynamics-ABM-master/color_patches/server.py", line 46, in <module>
    server = ModularServer(ColorPatchModel,
TypeError: __init__() takes from 3 to 5 positional arguments but 6 were given

Help me plz!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.