How do I find Nash Equilibria if I have Payoff functions instead of Payoff Matrix in MATLAB?

96 Views Asked by At

I am trying to implement the noncooperative game theory in my problem, where I framed two objective functions $J_1$ and $J_2$ for maximizing the power. I plotted the $ P_1$ and $P_2$ in MATLAB as shown in the figure.

$P_1 = - \frac{(6885376000000*x_1*(5000*x_2 + 261)^2)}{(1050003000*x_1 + 1050003000*x_2 + 13555000000*x_1*x_2 + 72685107)^2}$
$$J_1= - P_1$$

$P_2 = - \frac{(6885376000000*x_2*(5000*x_1 + 261)^2)}{(1050003000*x_1 + 1050003000*x_2 + 13555000000*x_1*x_2 + 72685107)^2}$ $$J_2= - P_2$$

Here $x_1$ and $x_2$ are the two control variables of Two players A and B, respectively. Now, I want to find the Nash Equilibrium in the Matlab. I tried using fmincon MATLAB function, but it did not match the result ($x_1=0.072=x_2~ P1=P2=2.220 $). I got confused why would I use fmincon or fsolve for the Nash equilibrium? (Actually, I read/studied Prisoner's Dilemma, etc, where Payoff is in the matrix, but here it is a function. That's why I don't have any idea.)
$x_1^* = L(x_2)= arg~min_{x_1}~J_1(x_1,x_2)$

$x_2^* = L(x_1)= arg~min_{x_2}~J_2(x_1,x_2)$

Also, I want to plot figures x1 and x2 where one is on the x-axis, and the other is on the y-axis, and the intersection shows the Nash Equilibrium point as shown in thde figure below.enter image description here. How should I find Nash Equilibrium and $x_1 and x_2$ plot? What will be the code in MATLAB? Thanks.

1

There are 1 best solutions below

1
On BEST ANSWER

I differentiated the J1 and J2 for their reactive control x1 and x2 and then equating with zero. $J_1=F_1(x_1,x_2)$, $J_1=F_1(x_1,x_2)$ $dJ_1/dx_1 =0$ $dJ_1/dx_1 = 0 $ $$F_1(x)=0$$ $$F_2(x)=0$$ Now using for loop plot the figure.

dJ1_dx1= diff(J1,x1) 
dJ2_dx2= diff(J2,x2)
ct=1;
for i = 0:0.001:0.2
r5(ct)=solve(subs(dJ1_dx1,R6,i)==0,R5);
ct=ct+1;
end
plot([0:0.001:0.2],double(vpa(r5,4)))

hold on

dt=1;
for j = 0:0.001:0.2
r6(dt)=solve(subs(dJ2_dx2,R5,j)==0,R6);
dt=dt+1;
end
plot(double(vpa(r6,4)),[0:0.001:0.2])

enter image description here