Computational Algorithm used in "Co-evolution of Individual Behaviors and Social Institutions" by Bowles, Choi and Hopfensitz (2002)

The simulation program was written in C++. Inquiries about the algorithm or requests for the code used should be directed to Jung-Kyoo Choi (  


  1. Groups and Agents
    • Create g groups and n agents.
    • Each agent is assigned a trait (A) or (N).
    • Each agent is assigned to one of the g groups[1]
    • With institutions:
  • Each group has a segmentation rate (sj) and/or a taxation rate (tj).

  • Initially both rates are set to zero and then they may evolve. For details about the evolution of institutions, see 3-(c) and 5-(c).

  1. The Game within Groups

a. Getting Partners

    • In every period, each agent is randomly paired to another agent of his group.
    • If the group size is an odd number, one agent is randomly selected and does not play the game in this period.
    • With institutions: segmentation

If within group segmentation is operative, each agent is assigned with probability s to be paired to an agent with the same trait as his, and with probability (1-s) he is assigned to a pool of agents that pair randomly.

Therefore three pools are created in a group:

1)      Agents with trait A that are paired with their own type

2)      Agents with trait N that are paired with their own type

3)      Agents with either trait  whose partner is drawn randomly from the mixed  pool.

 If anyof these pools consists of an odd number of agents, one agent is randomly selected to not participate in the game for this round. Therefore it is possible that a maximum of three players per group do not participate in the game in one round. 

b. Playing Games

Each generation, each agent plays a single one-shot prisonerís dilemma game and receives payoffs according to the payoff structure given in the text (unless he is selected not to play)

  1. Updating (or within-group individual selection)

a.       Payoff

        The game payoff to agent is:

pi  = baseline value +  payoff from PD game

                        With institution: resource-sharing

In the case of resource-sharing, a taxation rate of tj is taken from each agentís payoff. The proceeds of the tax from the whole group are redistributed equally to all members of the group. 

In other words, the payoff of agent i becomes:

pi' = pi  (1-tj) + (1/qj)(Sk  pk tj)

                        With qj  being group size of group j.

        If a group has some agents who did not play, we assume that pi =p, if agent i did not play (where p is the average payoff of the group which agent i is in).

b.   Fitness determination by spinning roulette wheel.

    • A parent pool is formed in each group by picking qj agents with replacement from the old generation. If an agent is selected, he is assumed to have one child with his trait. The probability that an agent is selected for the parent pool, fparent_pool , is  equal to the agents relative payoff compared to the total payoff of the group. i.e.:

fparent_pool = pi' / Sk  pk'  .

where the summation is over all group members. In other words, we assume that each agent receives a portion of a roulette wheel. The relative size of this portion is (pi ' / Sk  pk'). Then the wheel is spun qj times.

 c. Mutation

    • With probability e an agent randomly determines his trait. Therefore the probability of one agent switching type is e /2.
    • With institutions: There is a chance of mutation for the value for the institutions in each group. With probability μs = μt = 0.1 the level of the institution changes. With equal probability this change means an increase or decrease by 0.1.  
  1. Migration (Island Model)

Every member of the population has equal probability (m) to migrate to another group which is randomly selected among all the groups except its own[2]

  1. Group conflict

a. Forming the group competition pool

    • In each period, a group is involved in a conflict with probability k.
    • If the number of groups that are drawn to participate in a conflict is an odd number, one more group is picked and joins the group competition.

b.  Determining Winners

    • In the group competition pool, the participant groups are randomly paired.
    • A groupís total payoff is calculated as:

                    Total payoff of a group = Sk (pk' - c)  ,

      where the summation is over all group members and c = 0.5 (s2 + t2).

        The group with the higher total payoff wins the competition (therefore a larger group has an advantage in the competition).  

c. Merging and Splitting

    • After the conflict, the winning group repopulates the site of the losing group. Therefore the winning group becomes temporarily an enlarged group.
    • The population frequency of the winning group is applied to an enlarged group. Then the merged group is randomly split into two groups[3].
    • With institutions: The two newly created groups adopt the institutions of the winning group.  
  1. Go to the step 2.  

[1] We impose a lower bound for group size, i.e. every group must have at least 4 members. For details see footnote 2 and 3. [Go Back To the Previous Text]

[2] Since we set the lower bound of group size at four, the migration process stops when the group size reaches four during migration. No migration happens until the group gained immigrants. If group size > 4 migration is resumed and migration happens to the members who were supposed to migrate but not able to.[Go Back to the Previous Text]

[3] If one of two newly created group ends up with having less than 4 members, we randomly select member(s) from the other newly created group and assign them to the smaller group, so that both groups have at least four members. [Go Back To the Previous Text]

[Go Back to Artificial History Main Page]                     

Last Updated: 10-25-02