library(knitr)
library(ggplot2)
library(lpSolve)
Using the definition provided for the movement diagram, determine whether the following zero-sum games have a pure strategy Nash equilibrium. If the game does have a pure strategy Nash equilibrium, state the Nash equilibrium. Assume the row player is maximizing his payoffs which are shown in the matrices below.
Rose has a dominant strategy of R1.
If Rose Choose R1, no matter whether Colin decision to play C1 or C2, Rose will always get payoff 10.
If Rose Choose R2, then Colin will always choose C2 to make Rose get nothing Zero.
The pure strategy Nash equilibriam are R1, C1 and R1, C2.
The pitcher has a dominant strategy of throwing a knuckleball. In a pure strategy game, the Nash equilibrium occurs when the batter guesses knuckleball and the pitcher throws a knuckleball.The pitcher has a dominant strategy of throwing a knuckleball. In a pure strategy game, the Nash equilibrium occurs when the batter guesses knuckleball and the pitcher throws a knuckleball. All arrows pointing toward the equilibrium, the expected batting average is 0.250.
Build a linear programming model for each player’s decisions and solve it both geometrically and algebraically. Assume the row player is maximizing the payoffs shown in the matrices below.
This is the same problem presented in question 1.a from section 10.1:
Problem Statement Below are the variable declarations, objective, and constraints of our linear model from Rose’s perspective:
Let \[\begin{eqnarray} x &=& \textrm{percent of time playing R1} \\ (1- x) &=& \textrm{percent of time playing R2} \\ VP &=& \textrm{value of payoff for Rose} \end{eqnarray}\]Objective: Maximize VP
\[\begin{eqnarray} VP &\le& 10x+5(1-x)\\ VP &\le& 10x\\ x &\ge& 0 \\ x &\le& 1 \end{eqnarray}\].
intercept <- data.frame(x=c(0,0,1),y=c(0,5,10))
# plot
ggplot(data.frame(x=c(-1,1)),aes(x)) +
stat_function(fun=function(x) 5*x + 5, geom="line", aes(col='Colin pure C1: 10x + 5(1-x)')) +
stat_function(fun=function(x) 10*x, geom="line", aes(col='Colin pure C2: 10x')) +
geom_vline(xintercept=0, aes(col= 'x=0')) +
geom_vline(xintercept=1, aes(col= 'x=1')) +
geom_point(data=intercept, aes(x,y)) +
theme_bw() +
labs(title = 'Graphical Analysis for Rose', y = "VP") +
annotate('text', x = 0.1, y = 15, label="x = 0", size=3 ) +
annotate('text', x = 1.1, y = 15, label="x = 1", size=3 ) +
annotate('text', x = -0.1, y = 0.2, label="(0, 0)", size=3 ) +
annotate('text', x = -0.1, y = 5.2, label="(0, 5)", size=3 ) +
annotate('text', x = 0.85, y = 10.5, label="(1, 10)", size=3 )
From the plot above, we see that VP takes a maximum value of 10 when x = 1 (i.e. when Rose plays R1 100% of the time).
There are four constraints, with _4C_2=6 possible ways of intersecting four distinct constraints two at a time. The constraint boundaries for x 0 and x 1 are parallel; so we are left with five possible intersection points. The first four intersection points are found by setting x=0 and x=1 in the constraints representing Colin’s two pure strategies:
#R1
VP_R1R2_C1<-function(x){
return((10*x)+5*(1-x))
}
VP_R1R2_C2<-function(x){
return(10*x)
}
an1<-paste0('x=0 & R2C1: ','VP = (10 x 0) + 5(1-0) = ',VP_R1R2_C1(0))
an2<-paste0('x=1 & R1C1: ','VP = (10 x 1) + 5(1-1) = ',VP_R1R2_C1(1))
an3<-paste0('x=0 & R2C2: ','VP = 10 x 0 = ',VP_R1R2_C2(0))
an4<-paste0('x=1 & R1C2: ','VP = 10 x 1 = ',VP_R1R2_C2(1))
list<-c(an1,an2,an3,an4)
kable(list,col.names='Algebriac Modeling Analysis')
| Algebriac Modeling Analysis |
|---|
| x=0 & R2C1: VP = (10 x 0) + 5(1-0) = 5 |
| x=1 & R1C1: VP = (10 x 1) + 5(1-1) = 10 |
| x=0 & R2C2: VP = 10 x 0 = 0 |
| x=1 & R1C2: VP = 10 x 1 = 10 |
The fifth intersection point is found by setting the following two constraint equations equal to each other:
\[\begin{eqnarray} VP &=& 10x + 5(1-x) = 5x + 5 \\ VP &=& 10x \end{eqnarray}\]Solving the two equations simultaneously yields x=1, and VP = 10 otherwise VP=0.
Summarization of our possible solutions and chose the feasible ones.
| x | VP | Feasible |
|---|---|---|
| 0 | 5 | N |
| 1 | 10 | y |
| 0 | 0 | y |
| 1 | 10 | y |
| 1 | 10 | y |
Objective: Minimize VP
\[\begin{eqnarray} VP &\ge& 10\\ VP &\ge& 5y\\ y &\ge& 0 \\ y &\le& 1 \end{eqnarray}\].
intercept <- data.frame(x=c(0,0,1,1,2),y=c(0,10,5,10,10))
# plot
ggplot(data.frame(x=c(-1,2)),aes(x)) +
stat_function(fun=function(x) 10, geom="line", aes(col='Rose pure R1: 10')) +
stat_function(fun=function(x) 5*x, geom="line", aes(col='Rose pure R2: 5x')) +
geom_vline(xintercept=0, aes(col= 'y=0')) +
geom_vline(xintercept=1, aes(col= 'y=1')) +
geom_point(data=intercept, aes(x,y)) +
theme_bw() +
labs(title = 'Graphical Analysis for Colin', y = "VP", x = 'y') +
annotate('text', x = 0.1, y = 15, label="y = 0", size=3 ) +
annotate('text', x = 1.1, y = 15, label="y = 1", size=3 ) +
annotate('text', x = -0.1, y = 0.2, label="(0, 0)", size=3 ) +
annotate('text', x = -0.1, y = 10.5, label="(0, 10)", size=3 ) +
annotate('text', x = 0.85, y = 10.5, label="(1, 10)", size=3 ) +
annotate('text', x = 0.85, y = 5.5, label="(1, 5)", size=3 ) +
annotate('text', x = 1.85, y = 10.5, label="(2, 10)", size=3 )
Given our constraints and the plot above, Colin can play C1 any percent of the time between 0% and 100%. The minimum value of VP remains at 10, regardless of which value of y selected.
Once again, there are _4C_2=6 possible ways of intersecting four distinct constraints taken two at a time. The constraint boundaries for y 0 and y 1 are parallel; so we are left with five possible intersection points. The first four intersection points are found by setting y=0 and y=1 in the constraints representing Rose’s two pure strategies:
#R1
VP_R1R2_C1<-function(x){
return((10*x)+5*(1-x))
}
VP_R1R2_C2<-function(x){
return(10*x)
}
an1<-paste0('Y=0 & R1C1: ','VP = 1 x Y = ',10)
an2<-paste0('Y=1 & R1C2: ','VP = 1 x Y = ',10)
an3<-paste0('Y=0 & R2C2: ','VP = 5 x Y = ', 0)
an4<-paste0('Y=1 & R2C1: ','VP = 5 x Y = ', 5)
list<-c(an1,an2,an3,an4)
kable(list,col.names='Algebriac Modeling Analysis')
| Algebriac Modeling Analysis |
|---|
| Y=0 & R1C1: VP = 1 x Y = 10 |
| Y=1 & R1C2: VP = 1 x Y = 10 |
| Y=0 & R2C2: VP = 5 x Y = 0 |
| Y=1 & R2C1: VP = 5 x Y = 5 |
Solving the two equations simultaneously yields y=2, and VP = 10.
Summarization of our possible solutions and chose the feasible ones.
| Y | VP | Feasible |
|---|---|---|
| 0 | 10 | y |
| 1 | 10 | y |
| 0 | 0 | N |
| 1 | 5 | N |
| 2 | 10 | N |
Based on the feasible solutions, we see that Colin minimizes Rose’s payoff by playing C1 either 0% or 100% of the time.
We are considering the alternatives A, B, or C or a mix of the three alternatives under uncertain conditions of the economy. The payoff matrix is as follows:
mydf <- data.frame(Num1=c(3000,1000,4500),Num2=c(4500,9000,4000),Num3=c(6000,2000,3500))
row.names(mydf) <- c('A','B','C')
kable(mydf)
| Num1 | Num2 | Num3 | |
|---|---|---|---|
| A | 3000 | 4500 | 6000 |
| B | 1000 | 9000 | 2000 |
| C | 4500 | 4000 | 3500 |
| Set u | p and s | olve bo | th the investor’s and the economy’s game. |
Objective: Maximize V
\[\begin{eqnarray} V \le 3x_1+1x_2+4.5(1-x_1-x_2)\\ V \le 4.5x_1+9x_2+4(1-x_1-x_2) \\ V \le 6x_1+2x_2+3.5(1-x_1-x_2) \\ x_1,x_2,(1-x_1-x_2) \ge 0 \\ x_1,x_2,(1-x_1-x_2) \le 1 \end{eqnarray}\].
# objective function
object <- c(1,0,0,0)
Objects_Coditions<-data.frame(
# left side constraints
r1= c(-1,-1.5,-3.5,4.5), # condition 1
r2= c(-1,0.5,5,4), # condition 2
r3= c(-1,2.5,-1.5,3.5), # condition 3
r4= c(0,1,0,0), # x1 >=0
r5= c(0,0,1,0), # x2 >=0
r6= c(0,0,0,1), # x3 >= 1 note: x3 value must be 1 given current model form
r7= c(0,-1,0,0), # x1 <= 1
r8= c(0,0,-1,0), # x2 <= 1
r9= c(0,0,0,-1)
)
Objects_Coditions <- data.frame(t(Objects_Coditions))
R <- c(0,0,0,0,0,1,-1,-1,-1)
# lp function
lpFunc <- lp("max", object, Objects_Coditions, rep(">=", 9), R)
# solution
lpFunc
## Success: the objective function is 4.125
lpFunc$solution
## [1] 4.125 0.250 0.000 1.000
From the model output, we see that V is maximized at $4,125, with 25% allocated to alternative A, and 0% allocated to alternative B. Because of the relationship x_3=1-x_1-x_2, the allocation to alternative C is 75%.
Objective: Minimize V
\[\begin{eqnarray} V \ge 3y_1+4.5y_2+6(1-y_1-y_2)\\ V \ge y_1+9y_2+2(1-y_1-y_2) \\ V \ge 4.5y_1+4y_2+3.5(1-y_1-y_2) \\ y_1,y_2,(1-y_1-y_2) \ge 0 \\ y_1,y_2,(1-y_1-y_2) \le 1 \end{eqnarray}\].
# objective function
object <- c(1,0,0,0)
# left side constraints
Objects_Coditions<-data.frame(
r1= c(1,3,1.5,-6), # condition 1
r2= c(1,1,-7,-2), # condition 2
r3= c(1,-1,-0.5,-3.5), # condition 3
r4= c(0,1,0,0), # y1 >=0
r5= c(0,0,1,0), # y2 >=0
r6= c(0,0,0,1), # y3 >= 1 note: y3 value must be 1 given current model form
r7= c(0,-1,0,0), # y1 <= 1
r8= c(0,0,-1,0), # y2 <= 1
r9= c(0,0,0,-1) # y3 <= 1 note: y3 value must be 1 given current model form
)
Objects_Coditions <- data.frame(t(Objects_Coditions))
Objects_Coditions
## X1 X2 X3 X4
## r1 1 3 1.5 -6.0
## r2 1 1 -7.0 -2.0
## r3 1 -1 -0.5 -3.5
## r4 0 1 0.0 0.0
## r5 0 0 1.0 0.0
## r6 0 0 0.0 1.0
## r7 0 -1 0.0 0.0
## r8 0 0 -1.0 0.0
## r9 0 0 0.0 -1.0
# right side constraints
R <- c(0,0,0,0,0,1,-1,-1,-1)
# lp function
lpFunc <- lp("min", object, Objects_Coditions, rep(">=", 9), R)
# solution
lpFunc
## Success: the objective function is 4.125
lpFunc$solution
## [1] 4.125 0.625 0.000 1.000
The minimum payout to the investor V is $4,125. This payout is achieved by mixing 62.5% in condition 1, 0% in condition 2, and (100% - 62.5%) = 37.5% in condition 3.
Use the maximin and minimax method and the movement diagram to determine if any pure strategy solutions exists. Assume the row player is maximizing his payoffs which are shown in the matrices below.
In this example, Rose’s maximin row value is 10, which corresponds with strategy R1. Colin’s minimax column value is also 10, which corresponds to both C1 and C2. Because the maximin and minimax values are the same, this game has a saddle point. Actually, in this particular game, there are two saddle points, corresponding to R1,C1 and R1, C2. Both saddle points have a value of 10.