Month 3

  1. Basic aspects of the Prisoner’s dilemma game on graphs
  2. Iterated games
  3. Iterated PD games on complete graphs

Classroom Activity: Exploring Social Dynamics with Mathematica

Objective: To explore the dynamics of cooperation and defection within a social network using Mathematica.

Process:

0111111111
1000000101
1000001000
1000000110
1000010010
1000100110
1010000000
1101010011
1001110100
1100000100
Actual class Incidence Matrix
  1. Creating a Social Network Diagram: We will use Mathematica to create a visual diagram representing our class. This diagram will show the choices made by each individual in the class – whether they opt to be a cooperator (c) or a defector (d).
  2. Playing the Prisoner’s Dilemma (PD) Game: Using this diagram, each student will participate in the PD game. After the game, students will share their observations and conjectures.
    • Initial Strategy Distribution: Our starting strategies are ordered as follows: c, d, c, c, d, d, c, c, c, c.
  3. Exploring Frankie’s Conjecture: Frankie proposes that for a strategy distribution to uniformly converge to cooperation, the ratio of benefit β to cost ψ needs to be greater than 3. We’ll analyze if this statement holds true.

To illustrate the different connections between individuals in the classroom, we will use Mathematica to create a diagram. This diagram will display how each individual chooses between being a cooperator or a defector. Next, using this diagram, each student will play the Prisoner’s Dilemma (PD) game. After the game, we would like to hear your observations and any conjectures you believe to be true.

In order to create the diagram, we start by initializing the network and assigning colors to each individual:

n = 10;
couleur = {1 -> Blue, 2 -> Red, 3 -> Blue, 4 -> Blue, 5 -> Red, 6 -> Red, 7 -> Blue, 8 -> Blue, 9 -> Blue, 10 -> Blue};

Then, we define the adjacency matrix G representing the connections between individuals:

G = {{0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 1, 0, 1}, {1, 0, 0, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 0, 0, 0, 1, 1, 0}, {1, 0, 0, 0, 0, 1, 0, 0, 1, 0}, {1, 0, 0, 0, 1, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 0, 0, 0, 0, 0}, {1, 1, 0, 1, 0, 1, 0, 0, 1, 1}, {1, 0, 0, 1, 1, 1, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 0, 0, 1, 0, 0}};

Next, we compute the payoff for each agent in the network:

payoff = {};
Do[
    If[couleur[[j]][[2]] == , 
        payoff = Join[payoff, {Count[Table[couleur[[Flatten[Position[G[[j]], 1]][[k]]]][[2]], {k, 1, Length[Flatten[Position[G[[j]], 1]]]}],]*\[Beta]}],
        payoff = Join[payoff, {Count[Table[couleur[[Flatten[Position[G[[j]], 1]][[k]]]][[2]], {k, 1, Length[Flatten[Position[G[[j]], 1]]]}],]*(\[Beta] - \[Psi]) - Count[Table[couleur[[Flatten[Position[G[[j]], 1]][[k]]]][[2]], {k, 1, Length[Flatten[Position[G[[j]], 1]]]}],]*\(\[Psi])}]
    ],
    {j, 1, n}
];

Now, let’s examine the payoff for each agent in the network:

payoff

Computing the initial payoff for each agent in our network, we obtain the following:

AgentPayoff
16([Beta] – [Psi]) – 3[Psi]
23[Beta]
32([Beta] – [Psi])
43([Beta] – [Psi])
52[Beta]
63[Beta]
72([Beta] – [Psi])
84([Beta] – [Psi]) – 2[Psi]
93([Beta] – [Psi]) – 2[Psi]
102([Beta] – [Psi]) – [Psi]

Now, let’s focus on Agent 2. Agent 2, as a defector, is connected to Agents 8, 10, and 1 (all cooperators). To determine if Agent 2 will switch to being a cooperator, we compare the maximum payoff among Agents 8, 10, and 1 to the payoff of Agent 2:

Max[{payoff[[8]], payoff[[10]], payoff[[1]]}] - payoff[[2]]

Next, we need to solve a system of equations to analyze the conditions under which Agent 2 will switch to being a cooperator. Let’s solve for the variables $[Beta]$ and $[Psi]$:

Reduce[-3\[Beta] + Max[6(\[Beta] - \[Psi]) - 3\[Psi], 4(\[Beta] - \[Psi]) - 2\[Psi], 2(\[Beta] - \[Psi]) - \[Psi]] > 0 && \[Beta] > \[Psi] && \[Beta] > 0 && \[Psi] > 0, {\[Beta], \[Psi]}]

Agent 8 has several neighbors adopting a different strategy. However, Agent 8, as a cooperator, only has 2 neighbors who are defectors. To remain a cooperator, Agent 8 needs to ensure that its payoff is greater than the maximum payoffs associated with Agents 2 and 6 (the only 2 defectors in its neighborhood). Let’s determine the conditions for Agent 8 to remain a cooperator by solving a system of inequalities:

Simplify[Max[{payoff[[2]], payoff[[6]]}] - payoff[[8]]]

Next, let’s find the values for the benefit ($[Beta]$) and cost ($[Psi]$) with respect to which Agent 8 will remain a cooperator. Let’s solve the following system of inequalities:

Reduce[3\[Beta] - 4(\[Beta] - \[Psi]) + 2\[Psi] < 0 && \[Beta] > \[Psi] && \[Beta] > 0 && \[Psi] > 0, {\[Beta], \[Psi]}]

We obtain that $[Beta] > 0$ and $0 < [Psi] < [Beta]/6$, confirming Frankie’s conjecture.

Frankie’s conjecture states that if $[Beta]/[Alpha] > 3$, then the Prisoner’s Dilemma will converge to a uniform distribution of cooperators. This region is illustrated on the ($[Alpha]$, $[Beta]$)-plane shown below:

RegionPlot[\[Beta]/\[Psi] > 3 && \[Beta] > \[Psi] && \[Beta] > 0 && \[Psi] > 0, {\[Psi], -3, 3}, {\[Beta], -3, 3}, PlotPoints -> 100, PlotStyle -> Orange]

Next, let’s focus on Agent 6. Initially, Agent 6 was a defector. Agent 6 is connected to Agents 1, 8, 9 (all cooperators), and Agent 5 (a defector). To determine if Agent 6 will switch to being a cooperator, we can compare the payoff of Agent 6 against the highest payoff considering Agents 1, 8, 9. Let’s solve the following system of inequalities:

Reduce[payoff[[6]] - Max[{payoff[[9]], payoff[[8]], payoff[[1]], payoff[[5]]}] < 0 && \[Beta] > \[Psi] && \[Psi] > 0 && \[Beta] > 0, {\[Psi], \[Beta]}]

Finally, let’s examine the conditions for Agent 6 to remain a cooperator. Agent 6 has 4 neighbors, of whom 3 are cooperators and one is a defector. It is enough to ensure that the maximum payoff for Agents 9, 8, and 1 is greater than the maximum payoff of Agents 5 and 6. Let’s solve a system of inequalities to determine the conditions for Agent 6 to remain a cooperator:

Reduce[Max[{payoff[[9]], payoff[[8]], payoff[[1]]}] - Max[{payoff[[5]], payoff[[6]]}] > 0 && \[Beta] > \[Psi] && \[Psi] > 0 && \[Beta] > 0, {\[Psi], \[Beta]}]

Today (11/21/23) we are aiming to decide if it is true that as long as the ratio benefit over cost is larger than 3 then Agent 1 will remain a cooperator as the state of strategies evolves from its initial configurations?

Agent 1Verified
Agent 2Verified
Agent 3Trivially verified
Agent 4Trivially verified
Agent 5Verified
Agent 6Verified
Agent 7Trivially verified
Agent 8Verified
Agent 9Verified
Agent 10Verified

Through a careful analysis for each agent, we were able to verify that Frankie’s conjecture is true as shown in the table above and the code below (see QR code)

Still, as a class we wonder if there is a simple justification to Frankie’s conjecture. Why is it that every single system of inequalities solved lead to the conclusion that [Psi] < [Beta]/3? Is this somehow related to the geometry of the graph?

  • One thought that comes from a student in the class is the following: Every triple of consecutive nodes is embedded in a triangle and perhaps, this is where the pervasive `3′ is coming from in the solution of the system of inequalities.
  • The shortest path joining 2 arbitrary agent passing through 1, connects 3 agents.

Journal Assignment: Each student is asked to select an agent, preferably themselves, and conduct an analysis similar to that done for Agents 2 and 8. They should assess the conditions under which their chosen agent would switch between cooperating and defecting strategies.