NetLogo banner

 NetLogo Publications
 Contact Us

 Modeling Commons

 User Manuals:
 Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled because this model uses extensions.)


This is a reconstruction of a study by Peter Dittrich, Thomas Kron and Wolfgang Banzhaf (2003) entitled "On the Scalability of Social Order: Modeling the Problem of Double and Multi Contingency Following Luhmann" available here:

Each agent has two means of reducing uncertainty ('motivations') when interacting with others: expectation-expectation (EE) and expectation-certainty (EC).

EE refers to the efforts of an agent (�ego�)to make his/her responses to a particular message from alter predictable and hence consistent with ego�s prior responses. EE refers to ego�s expectation of alter�s expectation of ego. Agents can generate certainty by conforming to the expectations of others. Because the expectations of others cannot be observed, however, ego must anticipate that others will expect them to respond as they have in the past.

EC refers to the efforts made by agents to reduce the uncertainty of alter�s responses. Rather than basing one�s own behavior on the (anticipated) expectations of alter as in expectation-expectation, ego instead selects behaviors (or messages) that will elicit the most predictable responses.

Expectation-expectation orients behavior according to the query �How do I usually respond in these situations?�, whereas expectation-certainty orients behavior according to the query �How do you normally respond to my actions? The two behavioral algorithms are sometimes conflicting.

The purpose of the model is to see under what conditions can expect 'social order' to emerge. The primary variables of interest are 1. population size: will social order appear when 'double contingency' is 'scaled up' to multiple contingencies? 2. The 'strategies' that the agents adopt: will EE or EC be more successful at generating order? There are three different measures of social order which appear in the graphs.


Each agent selects an activity (from among a number of 'possibilities') in the following way:
1. For each activity, the agent determines how much it is expected by Agent B (EE)
2. The agent then determines how well the reaction of alter can be predicted by this activity.
3. The agent combines these two scores (calculated using Shannon's entropy formula) to arrive at an overall activity value. The 'alpha' parameter sets the relative weight given to EE or EC. A value of 0 means the agent wants to maximize EE, and 1 means the agent maximizes EC.

The agent then repeats steps 1-3 for each possible activity (set by the 'possibilities' parameter) and selects an activity. Alter does the same. In this model, their interaction is simultaneous.

As of now, all agents are tied to all other agents by directed links called 'actions.' Each action has an 'activity matrix'- a square matrix with dimensions set to the number of possibilities. So, if 'possibilities' is set to 2, this means that there are only two possible actions that an agent can choose. Each agent is connected to every other by links called 'actions' and each action has an activity matrix. The rows of the matrix represent ego's activities, and the columns represent alter's activities. After ego and alter have both selected activities (i for ego, j for alter), then 1 is added to that cell in ego's matrix, and respectively in alter's own activity matrix. In an interaction then, two directed links are activated, one from ego and one from alter, and the activity matrix of each is updated. The activity matrix is essentially a counting tool. It records and counts how many times a particular pairing of i and j have occurred.

The activity matrices are updated in one of two ways. If 'Memory?' is set to false, then this means that the agents have infinite memory! Then, each action pair that occurs causes the corresponding cell in each of the activity matrices to be updated (for ego and alter's 'action' links to the other). If 'Memory?' is turned on, then the extent of each agent's memory is set by the slider. Action links also possess another variable called 'action_history'- a list which records all of the action pairs. The length of this list is set to the memory (or infinite if the memory function is turned off). When memory is turned on, the action matrices are essentially erased every turn and then the rebuilt from scratch using the data from the action history list, plugging into each cell the number of times each particular action pair has occurred.

Each action link also possesses another matrix variable called 'A_values' which refers to each possible action's 'value'. Two different entropy values are calculated for each row (from ego's point of view, representing each possible action), one for EE and one for EC. For EE, ego is presented with the message received by alter (in this case the last action alter selected from their previous encounter), representing column j in ego's activity matrix for that action link to alter. A sum of this column is taken, and then for each cell in this column, a frequency distribution is calculated. This represents the percentage of times ego has responded with action i, to alter's action j. For EC, something similar happens, but the frequency distribution is counted for each row, then each cell is turned into a corresponding entropy value according to the formula: p*log p, to the base of n, where n is the number of possibilities. These are stored in a list, and then summed, to get the entropy value for each row (i.e. action alternative): entropy_i = 1 + the sum of the list. The procedure for EC is a little more complicated than EE, because in EE the frequency distribution will suffice because we are only dealing with one column, the given action of alter, whereas with EC we have to deal with each column (action by alter), comparing each row by converting each into cell into a frequency and then calculating the overall entropy for each row (i.e. action). For example, if there are only two possible actions, then there would be a 2x2 matrix. Given row i (e.g. action 1), ego looks at the distribution of j's responses. So, if, for row 1, cell 1,1 has a count of 25, and cell 1,2 has a count of 1, then ego knows that the action pair 1,1 is far more frequent than 1,2. Given action i, ego is pretty certain of alter's likely response. Ego must then, however, compare this certainty with that of action 2. If cell 1,1 consists of 10, but cell 1,2 has a count of 50 (assuming a very long memory!), then ego will be even more certain of action 2 and according to EC would select action 2 over that of action 1. This comparison is accomplished by using entropy values.

Finally, the selected action of the agent is determined by the equation:
(1 - a)EE + aEC
where 'a' is alpha. Each action is given an activity value based on this equation. The final action will be selected according to two criteria, given below.


The "selection" tab lets you choose either "Maximize" or "Proportional." Maximize means that the agents will select the activity with the largest 'activity value', whereas 'proportional' means that each activity is given a probability, a normalized measure of the activity value above, and the likelihood that the agent will choose this activity is equal to the activity's respective probability.

3 measures of order are given. The most interesting, sociologically, is the 'system level order' described as follows:

"Sociologically we can interpret the value OP as a measure of integration.... In all our simulation experiments a high value of OP has indicated a closure of the emerging activity system. This means that the better the agents are able to predict the activities of other agents as reactions to their own activity selections, the more the communication system appears to be operationally closed, that is certain activities follow certain activities."


1. As of now, all agents are connected to all others. The obsever asks each *action* (not each agent, but every action-link every turtle has to every other) to select an action. This means that for each turn, every agent performs n number of actions, where n is the number of other agents and also the number of action-links it possesses. It also means that for each tick, each turtle has performed n * 2 actions, because of double counting, each action sends and receives. This is cumbersome and the model slows down as the population size increases and as the number of possible communications increase. It would be interesting and relatively easy to constrain each agent's number of contacts, so that it can communicate with only its neighbors.

2. Another possibility is that each agent can observe the interactions among other turtles. Essentially, the idea is to allow 'information, knowledge, or belief' of the social whole to influence behavior.

3. Yet another possibility is to simulate 'language' as a cultural repository, since in this model, there is no distinction between utterance and information: they collapse into each other. This models communication at the 'analogical' or behavioral level, rather than the symbolic level. The only referent is the body itself, making present through demonstration that which it represents. There are no symbols. Furthermore, unlike honeybees who can communicate symbolically, human communication is primarily indirect: we repeat what we heard rather than what we saw personally. A honeybee cannot transmit second-hand messages. This would be an interesting addition to the model.


5. Complexity = possibilities exceed memory [i.e. 'information society' or 'triply helix']. Test what affect varying the memory and possibilities has on system order.


It should be possible to simulation referential communication: agents communicate *with* one another *about* some external referent, which could of course include themselves or other agents.


Preferential attachment algorithm found in the "Preferential Attachment" model included with NetLogo. Copyright 2005 Uri Wilensky.

(back to the NetLogo User Community Models)