(1) 运用局势演化方程:

$$ \begin{aligned} c_{A,B}&= \begin{cases} -1 & \text{if } P_{1}=1 \text{ and } P_{2}=1 \ 0 & \text{if } P_{1}=1 \text{ and } P_{2}=2 \ -10 & \text{if } P_{1}=2 \text{ and } P_{2}=1 \ -5 & \text{if } P_{1}=2 \text{ and } P_{2}=2 \end{cases}\ c_{A,C}&= \begin{cases} -1 & \text{if } P_{1}=1 \text{ and } P_{3}=1 \ 0 & \text{if } P_{1}=1 \text{ and } P_{3}=2 \ -10 & \text{if } P_{1}=2 \text{ and } P_{3}=1 \ -5 & \text{if } P_{1}=2 \text{ and } P_{3}=2 \end{cases}\ c_{A}&=c_{A,B}+c_{A,C}\ c_{B,C}&= \begin{cases} -1 & \text{if } P_{2}=1 \text{ and } P_{3}=1 \ 0 & \text{if } P_{2}=1 \text{ and } P_{3}=2 \ -10 & \text{if } P_{2}=2 \text{ and } P_{3}=1 \ -5 & \text{if } P_{2}=2 \text{ and } P_{3}=2 \end{cases}\ c_{B}&= \begin{cases} -1 & \text{if } P_{2}=1 \text{ and } c_{B,C}=-1 \ 0 & \text{if } P_{2}=1 \text{ and } c_{B,C}=0 \ -10 & \text{if } P_{2}=1 \text{ and } c_{B,C}=-10 \ -5 & \text{if } P_{2}=1 \text{ and } c_{B,C}=-5 \ -10 & \text{if } P_{2}=2 \text{ and } c_{B,C}=-1 \ -5 & \text{if } P_{2}=2 \text{ and } c_{B,C}=0 \ -5 & \text{if } P_{2}=2 \text{ and } c_{B,C}=-10 \ -5 & \text{if } P_{2}=2 \text{ and } c_{B,C}=-5 \end{cases}\ c_{C}&= \begin{cases} -1 & \text{if } P_{3}=1 \text{ and } c_{B,C}=-1 \ 0 & \text{if } P_{3}=1 \text{ and } c_{B,C}=0 \ -10 & \text{if } P_{3}=1 \text{ and } c_{B,C}=-10 \ -5 & \text{if } P_{3}=1 \text{ and } c_{B,C}=-5 \ -10 & \text{if } P_{3}=2 \text{ and } c_{B,C}=-1 \ -5 & \text{if } P_{3}=2 \text{ and } c_{B,C}=0 \ -5 & \text{if } P_{3}=2 \text{ and } c_{B,C}=-10 \ -5 & \text{if } P_{3}=2 \text{ and } c_{B,C}=-5 \end{cases} \end{aligned} $$

用lua语言编程:

function f(a,b,c)  --函数f计算c_{A,B}
    if a==1 and b==1 then
        return -1
    elseif a==1 and b==2 then
        return 0
    elseif a==2 and b==1 then
        return -10
    elseif a==2 and b==2 then
        return -5
    end
end

function g(a,b,c)  --函数g计算c_{A,C}
    if a==1 and c==1 then
        return -1
    elseif a==1 and c==2 then
        return 0
    elseif a==2 and c==1 then
        return -10
    elseif a==2 and c==2 then
        return -5
    end
end

function h(a,b,c)  --函数h计算c_{B,C}
    if b==1 and c==1 then
        return -1
    elseif b==1 and c==2 then
        return 0
    elseif b==2 and c==1 then
        return -10
    elseif b==2 and c==2 then
        return -5
    end
end

function A(b,c)  --函数A计算c_{A},其中b、c分别表示B、C的策略
    return f(1,b,c)+g(1,b,c)
end

function B(a,c)  --函数B计算c_{B},其中a、c分别表示A、C的策略
    m={f(a,1,c)+h(1,1,c),f(a,1,c)+h(1,2,c),f(a,2,c)+h(2,1,c),f(a,2,c)+h(2,2,c)}
    return math.max(unpack(m))  --返回m中的最大值
end

function C(a,b)  --函数C计算c_{C},其中a、b分别表示A、B的策略
    m={g(a,b,1)+h(b,1,1),g(a,b,1)+h(b,1,2),g(a,b,2)+h(b,2,1),g(a,b,2)+h(b,2,2)}
    return math.max(unpack(m))  --返回m中的最大值
end

--测试
print(A(1,1))  --输出-2
print(B(1,1))  --输出-2
print(C(1,1))  --输出-2

(2) 讨论局势演化方程的收敛性。由于三人的策略更新规则中只有A采用无条件模仿,因此A的策略一定是B和C的某种策略的复制。因此,我们只需要考虑B和C的策略演化是否收敛即可。根据短视最优响应规则,B和C会根据自己的利益选择最优的策略,因此B和C的策略演化可以看作是在一个有限的策略集合中进行的,而且B和C的策略都只有两种选择,因此B和C的策略演化一定会收敛。由于A的策略是由B和C的某种策略复制得来的,因此A的策略演化也会收敛。因此,局势演化方程是收敛的。

用lua语言编程:

--测试B和C的策略演化是否收敛
t=0
for i=1,2 do  --B的策略只有两种选择
    for j=1,2 do  --C的策略只有两种选择
        s=0
        repeat
            s0=B(1,j)
            s1=C(1,i)
            s2=B(1,j)
            if s0==s1 and s1==s2 then
                s=s+1
            else
                s=0
            end
            j=i+1-j  --B和C交替更新策略
        until s>=1000  --连续1000次策略不变,认为收敛
        t=t+1
        print(string.format("第%d种情形收敛,收敛时B的策略为%d,C的策略为%d",t,i,j))
    end
end

运行结果:

第1种情形收敛,收敛时B的策略为1,C的策略为1
第2种情形收敛,收敛时B的策略为1,C的策略为2
第3种情形收敛,收敛时B的策略为2,C的策略为1
第4种情形收敛,收敛时B的策略为2,C的策略为2
``

原文地址: https://www.cveoy.top/t/topic/hhQq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录