#OK to post homework #Natalya Ter-Saakov, Feb 13, Assignment 7 read "C7.txt": #Problem 2 #Donation Game: (where row 1 and col 1 are 'cooperate' and row 2 and col 2 are 'defect') DG:= [[[R,R],[S,T]],[[T,S],[P,P]]]; #For the row player, defecting dominates over collaborating, as it does for the column player, so the only possible Nash equilibrium is (Defect, Defect). #If T=R+0.01, R=10000P, S=P-0.01, then T > R > P > S still holds and so instead of getting 10000P each, they each get P, a significant amount slower. #Problem 3 #Snowdrift Game (T>R>S>P): SG:= [[[R,R],[S,T]],[[T,S],[P,P]]]; #Nash equilibria: #Consider (Refuse, Pay): If Player Col pays, then Player Row prefers to refuse (T>R). If Player Row refuses, then Player Col prefers to pay (S>P). Thus, this is a pure Nash equilibrium. #Consider (Pay, Refuse): If Player Row pays, then Player Col prefers to refuse (T>R). If Player Col refuses, then Player Row prefers to pay (S>P). Thus, this is a pure Nash equilibrium. #We know that (Pay, Pay) and (Refuse, Refuse) are not Nash equilibria because each player would switch if given the option. #In the last hw, problem 3, we proved that if there are two pure Nash equilibria, there is also a mixed Nash equilibrium. #The payoff for Player Row is P1:= ((R - S - T + P)*p2 + S - P)*p1 + (T - P)*p2 + P: #and the payoff for Player Col is P2:= ((R - S - T + P)*p1 + S - P)*p2 + (T - P)*p1 + P: #So p1 = p2 = (S-P)/(S+T-R-P) gives the mixed Nash equilibrium for this game. p1:= (S-P)/(S+T-R-P): p2:= (S-P)/(S+T-R-P): #Testing some random values of T,R,S,P: #(Note that we never run p2 because it will always be equal to p1) #Test 1 T:=rand(100)();R:=rand(T)();S:=rand(R)();P:=rand(S)(); MNE22(SG);p1; #Output: #T:=41, R:=31, S:=5, P:=1 #MNE22(SG):={[0,1],[1,0],[4/17,4/17]} #p1:=4/17 #Test 2 T:=rand(100)();R:=rand(T)();S:=rand(R)();P:=rand(S)(); MNE22(SG);p1; #Output: #T:=89, R:=33, S:=17, P:=10 #MNE22(SG):={[0,1],[1,0],[1/9,1/9]} #p1:=1/9 #Test 3 T:=rand(100)();R:=rand(T)();S:=rand(R)();P:=rand(S)(); MNE22(SG);p1; #Output: #T:=59, R:=28, S:=13, P:=1 #MNE22(SG):={[0,1],[1,0],[12/43,12/43]} #p1:=12/43 #Test 4 T:=rand(100)();R:=rand(T)();S:=rand(R)();P:=rand(S)(); MNE22(SG);p1; #Output: #T:=45, R:=43, S:=8, P:=4 #MNE22(SG):={[0,1],[1,0],[2/3,2/3]} #p1:=2/3 #Test 5 T:=rand(100)();R:=rand(T)();S:=rand(R)();P:=rand(S)(); MNE22(SG);p1; #Output: #T:=76, R:=38, S:=27, P:=6 #MNE22(SG):={[0,1],[1,0],[21/59,21/59]} #p1:=21/59