资源简介
用MATLAB实现gn算法,用空手道网络进行模拟
代码片段和文件信息
clear;
clc;
N=34;
bs=78
for i=1:N
for j=1:N
e(ij)=0;
end
end
e(12)=1;
e(13)=1;
e(14)=1;
e(15)=1;
e(16)=1;
e(17)=1;
e(18)=1;
e(19)=1;
e(111)=1;
e(112)=1;
e(113)=1;
e(114)=1;
e(118)=1;
e(120)=1;
e(122)=1;
e(132)=1;
e(23)=1;
e(24)=1;
e(28)=1;
e(214)=1;
e(218)=1;
e(220)=1;
e(222)=1;
e(231)=1;
e(34)=1;
e(38)=1;
e(39)=1;
e(310)=1;
e(314)=1;
e(328)=1;
e(329)=1;
e(333)=1;
e(48)=1;
e(413)=1;
e(414)=1;
e(57)=1;
e(511)=1;
e(67)=1;
e(611)=1;
e(617)=1;
e(717)=1;
e(931)=1;
e(933)=1;
e(934)=1;
e(1034)=1;
e(1434)=1;
e(1533)=1;
e(1534)=1;
e(1633)=1;
e(1634)=1;
e(1933)=1;
e(1934)=1;
e(2034)=1;
e(2133)=1;
e(2134)=1;
e(2333)=1;
e(2334)=1;
e(2426)=1;
e(2428)=1;
e(2430)=1;
e(2433)=1;
e(2434)=1;
e(2526)=1;
e(2528)=1;
e(2532)=1;
e(2632)=1;
e(2730)=1;
e(2734)=1;
e(2834)=1;
e(2932)=1;
e(2934)=1;
e(3033)=1;
e(3034)=1;
e(3133)=1;
e(3134)=1;
e(3233)=1;
e(3234)=1;
e(3334)=1;
ee=e;
bs1=bs;
m=0;
v=0;
for i=1:2*N
c1(i)=0;
c2(i)=0;
end
while bs>0
for i=1:N
for j=1:N
jeshu(ij)=0;
end
end
zitu=0;
for k=1:N
for i=1:N
d(i)=-1;
w(i)=0;
end
for i=1:N
for j=1:N
quan(ij)=0;
end
end
d(k)=0;
w(k)=1;
jilu=0;
for i=1:N
if e(ki)==1
d(i)=1;
w(i)=1;
jilu=jilu+1;
ls(jilu)=i;
end
end
lj=ls;
geshu=jilu;
while geshu~=0
jilu=0;
for i=1:geshu
for j=1:N
if e(lj(i)j)==1
if d(j)==-1
d(j)=d(lj(i))+1;
w(j)=w(lj(i));
jilu=jilu+1;
ls(jilu)=j;
elseif d(j)==d(lj(i))+1
w(j)=w(j)+w(lj(i));
end
end
end
end
lj=ls;
geshu=jilu;
end
t=0;
for i=1:N
if d(i)~=-1;
t=t+1;
z(t)=i;
end
end
if zitu==0;
for i=1:t
shequ(1i)=z(i);
end
for i=t+1:N
shequ(1i)=0;
end
zitu=zitu+1;
else
if t for i=t+1:N
z(i)=0;
end
end
pdd=1;
for i=1:zitu
pd(i)=0;
end
for i=1:zitu
for j=1:N
if shequ(ij)~=z(j)
pd(i)=1;
break;
end
end
end
for i=1:zitu
if pd(i)==0
pdd=0;
break;
end
end
if pdd==
评论
共有 条评论