G=[
0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0
0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0
0 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0
0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1
0 1 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1 1
1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 1 1 0 1
0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0
0 0 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 1 0
1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 1 0
1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 1 0
0 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0]
[ROUTES,PL,Tau]=tracasp(G,ones(400,400),50,30,1,400,1,10,0.9,5)
[ROUTES,PL,Tau]=imacasp(G,ones(400,400),1,1,1,400,1,10,0.9,5)
[ROUTES,PL,Tau]=ACASP(G,100,30,1,400,1,5,0.1,100)
%30只为一波的共100波蚂蚁,从像素1走到像素400,
信息素重要程度的参数1,启发式因子重要程度的参数5,信息素蒸发系数0.1,
信息素增加强度系数100
G=[
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0
0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0
0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0
0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0
0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0
0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
]
%[ROUTES,PL,Tau]=RPPACA(G,ones(400,400),50,30,1,400,1,10,0.95,1);