CoMSES Net Discourse Forums

Modeling Prejudice And Its Effect On Societal Prosperity

Modeling Prejudice And Its Effect On Societal Prosperity (version 1.0.0)

Existing studies on prejudice, which is important in multi-group dynamics in societies, focus on the social-psychological knowledge behind the processes involving prejudice and its propagation. We instead create a multi-agent framework that simulates the propagation of prejudice and measures its tangible impact on the prosperity of individuals as well as of larger social structures, including groups and factions within. Groups in society help us define prejudice, and factions represent smaller tight-knit circles of individuals with similar opinions. We model social interactions using the Continuous Prisoner’s Dilemma (CPD) and a type of agent called a prejudiced agent, whose cooperation is affected by a prejudice attribute, updated over time based both on the agent’s own experiences and those of others in its faction. This model generates various results that both provide new insights into intergroup prejudice and its effects, as well as highlight and reinforce certain existing notions of prejudice.

Release Notes

Modelling Prejudice and Its Effect on Societal Prosperity

This repository contains the code used for the modelling process as described in the paper, along with scripts to generate all plots and tables in the paper.


Code must be run using Python 3 or higher. For a list of required modules, refer to requirements.txt, or simply run the following

pip install -r requirements.txt

Repo structure

All the classes for all the agent types that make up the base of our model may be found in the directories “twoGroups” and “nGroups”, each of which contain the agent classes for two group and multi-group societies respectively. The remaining directories contain instantiations of the model class used for generating the corresponding result objects. The names of these directories are the same as the result object in the paper they correspond to.

Generating plots

Shell scripts have been written corresponding to each result object in the paper, and labelled accordingly. Therefore, to generate the plot in, say Fig 1(b), simply run

Each result is generated as an average of 10 runs of the model, which may take upto 5 minutes to finish execution. Note that some results are generated using the outputs from multiple experiments, and hence may take longer to generate. Fig 1(c) in particular shows the output of 20 experiments, and hence may take well over 1 hour to execute.

After execution, the pickle files for each model are saved in the respective directories. The final plot generated in saved as a png file in the root directory, and are labelled appropriately.

This is a companion discussion topic for the original entry at