Computational Model Library

Unified Opinion Dynamics Simulator (version 1.0.0)

This is a simulator for the unified opinion dynamics framework, as developed by Adam Coates, Anthony Kleerekoper, and Liangxiu Han.

Release Notes

The Unified Opinion Dynamics Simulator is a Python script that allows authors to publish small kernels of Python code that correspond to “rule modules”.

Operation:
The simulator is executed by calling the main() method within main.py with one argument - a list of arguments in the standard command-line format. If run standalone, this executes one experiment I was recently running, as an example. It is suggested to use the -c [config] argument to specify a configuration file.

Settings:
Options are loaded from arguments passed to main, a file passed via the -c argument, and default.cfg, in that order of precedence. For a command-line option to be recognized, it must be initialized in a configuration file as well. This is a technical limitation I intend to fix in the future.

Control Flow:
Algorithms are invoked in the following order:
Edge
Initial
Layout
Intervention
(loop)
Group
Update
Analysis
(end loop)
Analysis

Algorithms:
A selection of algorithms - all those I have used to date - is provided for use.
These algorithms make frequent use of two arguments, graph and opts.
Graph is the object representing the current network of agents, as described within the Networkx documents.
Opts is an object containing the current options, which can be accessed via property access: for example, opts.initial.uncertainty.
As these objects are passed around by reference, modifications to them will be persistent and seen by other rule modules.
Below, peculiarities to each will be discussed.

Analysis:
Must define two functions, analyse(graph, opts, chosen) and final_analysis(graph, opts).
Chosen is the last returned value of the Group rule module’s invocation.
Neither of these functions need return anything, but should probably write to a file if you want to keep your results.

Edge:
Must define a function, make_graph(opts).
This function must return a Networkx graph object.

Group:
Must define a function, select_agents(graph, opts).
This function must return a tuple of two lists of integers. In the update module, nodes with IDs in the first list are acted upon by those nodes with IDs in the second list. An agent may appear in both lists.

Initial:
Must define a function, set_initial(graph, opts).
This function must return a dictionary with a key named “opinion”, as well as any other keys. These keys must have as their value a list of any objects. Agents will have the initial properties set such that for agent n, that agent’s opinion is found by looking up [“opinion”][n] in this dictionary.

Intervention:
Must define a function, intervene(graph, opts).
This function need not return anything. It is expected to perform some manipulation on the graph such as deleting nodes or edges, but is not required to do so.

Layout:
Must define a function, make_layout(graph, opts, layout).
This function must return a Networkx layout. The layout parameter may be a Networkx layout, but is usually None.

Update:
Must define a function, perform_update(graph, opts, agents).
This method need not return anything. It is expect to update graph.values[“opinion”] for the nodes in one or both lists in the agents parameter, generated by invoking the group rule module.

Version Submitter First published Last modified Status
1.0.0 Adam Coates Wed Jun 20 06:32:45 2018 Wed Jun 20 06:32:45 2018 Published

Discussion

This website uses cookies and Google Analytics to help us track user engagement and improve our site. If you'd like to know more information about what data we collect and why, please see our data privacy policy. If you continue to use this site, you consent to our use of cookies.