From Earlham CS Department
Jump to navigation Jump to search

Computational Sociology and Agent Based Modeling


This unit showcases Agent Based Modeling techniques and allows students to investigate them in a computational sociology context.

Background Reading for Teachers and TAs

Reading Assignments for Students

Reference Material

  • Tutorial on Agent Based Modeling ACM Digital Library An in depth look at ABM theory and technologies.

Lecture Notes

  • Lecture 1
    • Comp. Soc. begins with Axtell and Epstein.
      • They wanted to "...begin the development of a computational approach that permits the study of... [trade, migration, group formation, combat, interaction with an environment, transmission of culture, propagation of disease, and population dynamics] ...from an evolutionary perspective as a single social science, a transdiscipline subsuming such fields as economics and demography." (Epstein 2)
    • How is this new discipline implemented?
      • Agents
        • Internal state
        • Behavioral rules
        • Some static states (ie race), many influenced by environment according to rules (ie economic status, cultural identity) (Epstein 4)
      • Environment
        • "Medium through which agents interact" eg topographic landscape or communication network (Axtell 5).
        • Can be static or change over time (either through agents' actions or otherwise)
      • Rules
        • Dictate what agents can do and what their environments can do; eg 'look around as far as you can, find the site richest in food, go there, eat the food' (Epstein 5)
        • Agent-Environment rules (ie food collection)
        • Agent-Agent rules (ie reproduction)
  • Lecture 2
    • Emergent Behavior
      • As Axtell and Epstein state, "The defining feature of an artificial society model is...that fundamental social structures and group behaviors emerge from the interaction of individual agents operating on artificial environments under rules that place only bounded demands on each agen'ts information and computational capacity" (Epstein 6).
      • Features like tribal formation and economic classes should naturally arise (Epstein 6)
    • The big idea?
      • That micro-simplicity leads to macro-complexity.
      • Sugarscape model (Epstein 21-53)
        • To demonstrate and explore their theories, Epstein and Axtell created the Sugarscape.
        • It consists of a landscape with varying levels of resources called "sugar" and "spice" populated by randomly dropped agents who require the sugar to stay alive.
        • The agents mate and reproduce if they can get enough food; otherwise they move about seeking new food sources.
        • Agents are aware of their families
        • Agents have a preference for either sugar or spice and are allowed to trade with one another (or borrow and lend).
        • Agents are given rules for combat
        • A&E witnessed the formation of tribes, economic classes, migratory patterns, and warfare.
  • Lecture 3
    • Where is ABM useful?
      • Economics
        • Economics is largely a science of local interactions - buyers and sellers, loaners and borrowers - that create a complex macrocosm.
      • Sociology
        • Like economics, societal structure is the amalgam of local interaction - altercations, friendships, elections.
      • Biology
        • Many events within the human body are best characterized by the interaction of simple agents (cells) that make up larger parts of a given organism; arguably, sufficiently complex living bodies can be seen as huge-scale agent based systems.
      • Information Science
        • The exchange of information is, again, a local process; groups' ideas about something derive from a bunch of individuals' notions and their local communication.
    • Where is it not useful?
      • When attempting to model something that is simple at a high level and complex at a low level.
      • When attempting to model agent sets with high levels of heterogeneity
        • A model of a rocket's trajectory, for example, could be represented as a series of agents - air molecules, rocket materials, units of power (thrust) - but the number of agents involved is far too high for this to be accomplished in any human-acceptable amount of time.
  • Lecture 4
    • What are its advantages and disadvantages?
      • Advantages
        • Can describe things through emergence that mathematical formulas can't
        • Tend to require far less "wet" research
        • Programming can be simple (using ABM frameworks)
      • Disadvantages
        • Sometimes too simple
        • Don't always scale well
    • Ties to object oriented programming (high level, so as not to confuse) (Axtell 5)
      • Encapsulation of internal state
      • Procedures == agent's behavioral rules
    • Some Examples - Sociology and otherwise
      • Boids Model of bird flocking.
      • Ants Model of ants' food collection habits
      • Moths Model of moths' love for light sources
      • Traffic Grid Model of city-grid traffic
      • Scatter Model of children's scattering tendencies
      • Segregation Recreation of Schelling's original segregation model
      • Cooperation Model of cooperation / competition for resource

Lab 1

Rebellion model in NetLogo


Run through the following steps, answering each question.

  1. Run the model with its initial parameters and observe for aout 200 ticks.
  2. Suppose you wanted to discuss how often rebellions happened in this artificial society. What graph most prominently displays this?
  3. Suppose you are the head of state for this artificial society. You want to extend the period between rebellions; what parameter would you change and why? Make this change, and rerun the model if necessary. Were you correct?
  4. Say you wanted to verify this model against the political history of some nation. How would you map events from the real nation's history to controls the model? What kinds of controls could you add?
  5. How does the movement toggle affect the frequency and amplitude of rebellions? What could this toggle represent in the real world?
  6. Now attempt to create these patterns by changing the different settings of the models (potentially needing to restart the model). For each pattern, note exactly what value each control ( init-cop density, init-agent density, vision, legitamacy, max-jail-temrm, movement).
    1. Constant rebellion.
    2. Quiet, idyllic, happy society.
    3. Quiet, dystopic, unhappy society.
    4. Underfunded government that recently suffered a military coup.
    5. Mostly quiet with periodic flares of protest.
    6. Rebellious territory with highly restricted citizen movement (think occupied territories)


  1. Answers to the questions in the lab.
  2. Parameter values for each scenario.


  • Java
  • NetLogo

Bill of Materials

  • Pencil and paper or a word processor.

Lab 2

Excercise in coming up with agent sets and agent relations. Have students think about a possible model of Saga sitting patterns over time. Their assignment is to come up with a set of agents and a set of agent relations and a short description of how such a model's results would evolve over time.


  • What to do, step-by-step
    • Discuss with your lab mates a potential "Saga Sitting pattern" model with attention to the factors involved and potential ways of collecting data. Write down these notes.
    • Brainstorm a set (with a size of at least 4) of agents that could be used in such a model. Write up a description of each model and explain why you thought it would be useful.
    • Brainstorm a set of relations between agents that could be used in such a model. Examples include students' like or dislike of certain food agents, students' like and dislike of each other, students' attendance at simulatneous events. Write up a description of each relation and explain why you thought it would be useful.
  • What to look for
    • Is it hard or easy to account for many of the involved factors? Why?
    • How does this process differ from other types of modeling?
      • Do you think coming up with mathematical formulas to describe the same issues would be easier or harder? Why?
      • What challenges arise when you try to come up with agents? with agent relations?
  • What to record
    • Your notes and agent / agent relation descriptions
    • Your answers to the 'what to look for' questions.
    • A short description of how such a Saga model, using your agents and agent relations would evolve over time.


  • Required elements
    • Notes and descriptions
    • Answers
    • Model outcome + saga map.
  • Visualization opportunities
    • Draw out a map of saga to aid in your final description
  • Optional elements
    • None
  • Provide a template for the first couple of labs ala CS128?
    • Not sure? I didn't take CS128.



Bill of Materials

Nada. Paper and pencil.


CRS Questions

  • 1. What is Emergent Behavior?
    • A. The complex outcome of the interaction of many simple rulesets
    • B. How we verify and validate Agent Based models
    • C. How we define rulesets for agents in an agent based model
    • D. How we determine the formulas we use in mathematical modeling
  • 2. Who wrote the seminal text on sociological agent-based modeling?
    • A. Peck & Rogers, et. al
    • B. Axtell and Epstein
    • C. Axeman and Edlefsen
    • D. Stribling, Aguayo, and Krohn
  • 3. What is the name of the first agent-based biological model?
    • A. Droids
    • B. BirdBots
    • C. Boids
    • D. BDroids

Quiz Questions

  1. Explain how agent based modeling's concept of emergent behavior could be used to explain some natural phenomenon.
  2. Name three good examples of things that could be used as agents.
  3. Name three good examples of agent relations that could be used in a model.
  4. Explain why it is sensible to model bird flocking using ABM. Extend this to justify modeling society with ABM.

Agent Based Modeling and Computational Sociology Metadata

This unit introduces students to Agent Based Modeling through the use of examples and then has them work in a context of Computational Sociology to learn more This section contains information about the goals of the unit and the approaches taken to meet them.

This section contains information about the goals of the unit and the approaches taken to meet them.


Should certainly come after mathematical modeling and before systems dynamics.

Concepts and Techniques

  • Pedagogical
    • Inquiry Based Learning
    • Degrees of open endedness
    • uses science to illustrate complexity of world around us
  • Structural
    • CRS
    • largely platform independent

General Education Alignment

  • Analytical Reasoning Requirement
    • Abstract Reasoning - From the [Catalog Description] Courses qualifying for credit in Abstract Reasoning typically share these characteristics:
      • They focus substantially on properties of classes of abstract models and operations that apply to them.
        • Complete. Agents are, definitively, abstract models. The whole purpose of the unit is to think about the people and the world around you in abstract terms.
      • They provide experience in generalizing from specific instances to appropriate classes of abstract models.
        • Complete. There is Discussion of boids, sugarscape and agent based modeling as a whole
      • They provide experience in solving concrete problems by a process of abstraction and manipulation at the abstract level. Typically this experience is provided by word problems which require students to formalize real-world problems in abstract terms, to solve them with techniques that apply at that abstract level, and to convert the solutions back into concrete results.
        • Complete. The emergent behavior is a process of abstract manipulation; comparing emergent behavior back against the real world is "converting solutions back into concrete results"
    • Quantitative Reasoning - From the [Catalog Description] General Education courses in Quantitative Reasoning foster students' abilities to generate, interpret and evaluate quantitative information. In particular, Quantitative Reasoning courses help students develop abilities in such areas as:
      • Using and interpreting formulas, graphs and tables.
        • Partial. Little of this - the point is to avoid formulas (initially), but graphs and tables come up when analyzing model results.
      • Representing mathematical ideas symbolically, graphically, numerically and verbally.
        • Partial. Little of this. We're working with people, not numbers.
      • Using mathematical and statistical ideas to solve problems in a variety of contexts.
        • None.
      • Using simple models such as linear dependence, exponential growth or decay, or normal distribution.
        • None. This could be worked in, but isn't there now.
      • Understanding basic statistical ideas such as averages, variability and probability.
        • None.
      • Making estimates and checking the reasonableness of answers.
        • Partial. Estimates are made, but they are not so quantitative as in more mathematical endeavors.
      • Recognizing the limitations of mathematical and statistical methods.
        • Complete. This is fulfilled - the point of ABM is the limitation of mathematical and statistical methods.
  • Scientific Inquiry Requirement - From the [Catalog Description] Scientific inquiry:
    • Develops students' understanding of the natural world.
      • Complete. Agent based methodology informs a way of thinking about natural processes that differs from more typical techniques - the ideas of emergent behavior are present in every day life.
    • Strengthens students' knowledge of the scientific way of knowing — the use of systematic observation and experimentation to develop theories and test hypotheses.
      • None.
    • Emphasizes and provides first-hand experience with both theoretical analysis and the collection of empirical data.
      • Complete. Models are theoretical. Analyzing one's own social circle, for example, is empirical collection.

Scaffolded Learning

None. The unit is lecture and work; neither fall into a set scaffolded structure.

I think you could re-consider this for the lab. Start simple, provide a bit of structure, and let them extend into and through that as far as they can.

Inquiry Based Learning

The get to think creatively; they make a (static) model and get to think up their own agent based model (in an easy, but still interactive, way)

Agent Based Modeling and Computational Sociology Mechanics

To Do

  • Read and consider JoshM's message about alife.
  • Expand lectures notes.
  • Come up with second lab, do design.
  • Consider the exercise-like things that Raush uses at the start of his article Seeing Around Corners


  • Make answers bold please!
  • Some of this is reference/extra reading, then? If this is only a 1 week unit, will they just get a big pile of reading up front? -There are snippets of each reading that I think should be assigned.
  • When you say evolve over time, do you mean how the model would look when it was run, or how the people making the model would change it as they learned more information? Added a few words to clarify.
  • + why? (yes/no-type questions are really easy for students to totally blank out)
  • Looks like this clarifies the above comment's question
  • + why?
  • A minimum number would be helpful here. People are lazy.
  • Where were the example applets??
  • These are very high-level... narrowing them down more will help a great deal. Also, how is the split made between the two+ classes?
  • I'd argue that they need to be expanded, that at a high level they cover the correct topics but need more depth to be useful.
  • This lab seems kind of short as compared with the other ones, which isn't necessarily a bad thing. However, if you wanted to move it to a prelab in order to have more time to do some sort of example or have them do something with Looking Around Corners as part of the lab, that might be good. On the other hand, you could also have them do some real life homework, like looking at the distribution of how people sit in Saga. Maybe they could find some environmental factors that influence students in Saga as well (ie people tend to sit closer to food?).
  • Agreed, I'm not sure this would fill up an entire 3 hours or however long labs are. Re: real life homework/observations: are people just people, or would we want them to account for gender, race, year, age, etc?
  • How is it useful in these disciplines? etc~

Lab Feedback

  • My only real issue with this lab is that isn't exactly so much a lab as a very interesting thought experiment. There should be some component of this lab that has them doing something and producing answers to questions with data and interpretation of that data at some point. The lab as it stands could definitely make a very good first chunk of a lab without too much change. The biggest change to make to what's already there would be to give more concrete deliverables. I found myself spending upwards of 3 hours on just this thought experiment because I had no idea what was an appropriate amount to write on each step. To make this lab complete past just that first part, there should be a second part that pushes them out of theory and into practice in one way or another.
  • I loved the first part of the lab. It was very fun to tweak the values in order to get the results that were desired. The questions were straightforward and easy to answer, but they still required a little bit of thought behind them, which I thought was a very nice touch. One thing to keep in mind with the section of the lab, however, is that what makes up a dystopia can be very subjective. My impression of it was that jail times would be long, there would be lots of police, and the police would have an overwhelming presence. This may not be an idea that other people share.
  • Another thing to point out is that it's not immediately obvious what the "visual range" toggle does. I was under the impression that it decreased the visible range of the agents themselves, making the rebellions take less long to spread. However, after some tampering with it, I'm positive that it dictates how far the cops can see, which has a factor in the "Risk calculation" that causes the agents to determine whether it is safe to rebel and therefore rebel. You might want to look into providing the students with a bit of information about the various controls and what they do. It doesn't have to be very in-depth, as I got the sense that part of the lab was figuring out what it does, but a little information might be nice.
  • This would probably take about an hour or two to do well, especially if some thought and deliberation were given to the questions. Otherwise, it wouldn't take very long at all. This would probably be a great way to tell apart those who put some time and effort into it from those who didn't care, actually.
  • Worked pretty well. The second part of the Lab gets the students thinking. Need to know a knowledge of agent-based modeling, so if the students didn't understand during the lectures, they will need to figure it out to complete this lab.

Lab Write-up

Josh Letter

Hey Nate and Charlie,

Sorry for the delay in my response; this is a contentious topic and it's the last week of class over here.

Personally, I've been conflicted about the use of computational sociology for a while. It mirrors a larger debate in social science disciplines and their different perspectives on solving the same problem: predicting and understanding human behavior. Suscintly, sociology and anthropology study the productions of human interaction on the large scale (such as entire populations, economic systems, and nations) while psychology studies smaller scopes indepth (things like emotions of individual humans, dreams, etc). When the two ends meet in the middle by sociologists working down and phsycologists work up, we should have a pretty good understanding on how humans interact.

One side known as aLife, the side you've delved into, uses simple, local rules over many agents in simple virtual environments to observe emergent behavior. While this approach works well for modeling the behavior of some systems (like Boids, termites, and other things that use steering behavior -- check out open steer by Reynolds, the Boids guy), its usefulness depends directly on the efficacy of the rules used. At best the rules represent aggregate behaviors which are determined by valid and verifiable quantitative or qualitative experimental analysis. At worst, which is unfortunately true of many popular systems (including Boids), the rules represent whatever was floating around in the researcher's head at the time (though this can be seen as being a valid production of a social entity and may have its own validity).

If you have a simulation that has many agents that adhere to accurrate and simple rules that apply to a virtual environment that has a relatively small state space (like Sugarscape), all social interaction outside of the simulation is not possible and would have no impact on your results. There is no room for the "irrational" behavior seem when social scientists study people in the real world. In this case, irrationality is behavior that seems to be not in the observed entity's best interests given the variables observable by the social scientist. This does not mean the agents are inheritly irrational; they just base their decisions on rules different that those placed on the situation by the social scientist's perspective (think latent variables to put it into something more palatable for hard sciences). This lack of coverage of the effect of latent variables in individual agents in macro computational sociology is the main criticism levied against the field.

The other side of the larger social science debate, there is research being conducted that attempts to model the complexity of individual agents. This research ranges from modeling how the brain works mechanically, such as the ACT-R 5.0 architecture, to true-to-psych emotion and cognitive models (PyschSim and EMA by Stacy Marsella). The major criticism of this work is pretty straightforward: can we even understand the true complexity of how we think, let alone simulate it? Just another NP problem, right?

There is work that is trying to meet in the middle. Later additions to PsychSim and EMA, Thespian (Mei Si), the SGD (Synthetic Group Dynamics) Model of multiagent social interaction (Ana Paiva, check out FearNot!), and much more synthetic characters research are all in the space between macro computational sociology and complex, low agent count simulations. The problem a lot of qualatitive-phobic types have is that they don't produce neat numbers like hard scientific (Folding@Home) and aLife simulations. However, they do have some qualatative metrics, but the field of virtual human is still quite young (unlike aLife techniques and cellular automata) is still figuring out how to best evaluate itself. Good examples are in space of Embodied Conversational Agents (ECAs) used by Justine Cassell to treat autism and of the work in expressive intelligence field, such as the game Façade by Michael Mateas (playing Façade might be a good homework assignment for the class).

To wrap up, simulating social science touches many active fields of research and I'm a bit biased as I reside in one of those fields (expressive intelligence). If you want more information or something stated more clearly, feel free to email or call me on my cell -- I'd be happy to help out EC's CS department in any way I can. The class sounds like it will be fun!

Here are some links to back up my references: http://opensteer.sourceforge.net/ Justine Cassel: http://www.soc.northwestern.edu/justine/ Stacy Marsella: http://www.isi.edu/~marsella/root/root.html Ana Paiva: http://gaips.inesc-id.pt/gaips/people/anapaiva.html http://www.cyc.com/ http://www.opencyc.org/ ACT-R reference: Anderson, J. et al. 2004. An integrated theory of mind. Psychological Review, 111(4):1036–1060.

Cheers! Josh


  • Tie this in with facebook/myspace/<social network here (virtual or real)>. Who do you know? Draw a graph of your best friends, good friends, acquaintances, less-than- acquaintances and follow the coloring/sizing of the model. Does this model resemble what emerges in the dynamic model (below)? Do several runs of the model and match their emergent stages against your drawing. Discuss validity of model based on this. The key for the lab is "Does this model resemble what emerges in the dynamic model?" The applet will run until it reaches a state of relative stasis. The static model that the students develop will, hopefully, have similar characteristics to the applet's emerged results. The idea is that 'reality' - the static model - appears in the emergent behavior of the dynamic model


Nate Smith