📄 zgame.m
字号:
% the program is with the matrix game theory:two person zero-sum games
% please input the payoff matrix
input('the program is with the matrix game theory')
m=input('Please input the line number=')
n=input('Please input the column number=')
D=input('Please input the payoff matrix D(m,n)=')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:m
minnumber=D(i,1);
for j=1:n
if D(i,j)<minnumber
minnumber=D(i,j);
end
end
mintemp(i)=minnumber;
end
maxnumber=mintemp(1);
for i=1:m
if mintemp(i)>maxnumber
maxnumber=mintemp(i);
end
end
maxmin=maxnumber;
%for i=1:m
% if mintemp(i)==maxmin
% strategy1=i
for j=1:n
maxnumber2=D(1,j);
for i=1:m
if D(i,j)>maxnumber2
maxnumber2=D(i,j);
end
end
maxtemp(j)=maxnumber2;
end
minnumber2=maxtemp(1);
for j=1:n
if maxtemp(j)<minnumber2
minnumber2=maxtemp(j);
end
end
minmax=minnumber2;
if maxmin==minmax
input('The matrix game has the most_robust equlibrium solution')
input('The strategies of the game is')
for i=1:m
if mintemp(i)==maxmin
Player1_strategy=i
end
end
for j=1:n
if maxtemp(j)==minmax
Player2_strategy=j
end
end
input('The value of the game is:')
maxmin
else
input('The matrix game DOES NOT have pure solution,Please use another method!')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -