A list,

1. Ant colony algorithm is proposed

Ant Colony Optimization algorithm (ACO), also known as ant algorithm, is a probabilistic algorithm used to find optimal paths. It was proposed by Marco Dorigo in his PhD thesis in 1992 and was inspired by the behavior of ants in finding their way to food. Genetic algorithm has been applied in pattern recognition, neural network, machine learning, industrial optimal control, adaptive control, biological science, social science and so on.

2. Basic principles of the algorithm





Ii. Source code

CLC Clear load data Z information % Starting coordinates STARty =10;
starth=3; % endy=8;
endh=5;

n=10;
m=21; Best=[]; [path,information]=searchpath(n,m,information,z,starty,starth,endy,endh); % path find fitness=CacuFit(path); % fitness calculation [BESTFITNESS, Bestindex]=min(fitness); % bestpath=path(bestindex,:); Best=[Best;bestfitness]; % % Update pheromone ROU =0.2;
cfit=100/bestfitness;
k=2;
for i=2:m- 1
    information(k,bestpath(i*2- 1),bestpath(i*2)) = (1-rou)*information(k,bestpath(i*2- 1),bestpath(i*2))+rou*cfit;
end
    
    
for kk=1:1:100kk [path,information]=searchpath(n,m,information,z,starty,starth,endy,endh); % path find fitness=CacuFit(path); % crossover.simulation [newbestfitness newbestindex] = min (fitness); % optimum fitnessifnewbestfitness<bestfitness bestfitness=newbestfitness; bestpath=path(newbestindex,:); end Best=[Best;bestfitness]; % % Update pheromone ROU =0.2;
    cfit=100/bestfitness;
    k=2;
    for i=2:m- 1
        information(k,bestpath(i*2- 1),bestpath(i*2)) = (1-rou)*information(k,bestpath(i*2- 1),bestpath(i*2))+rou*cfit;
    end
    
    
end

for i=1:21
    a(i,1)=bestpath(i*2- 1);
    a(i,2)=bestpath(i*2); End % Starting point (10.10), endpoint coordinates (13.14)
starty=10;
starth=14;

path=zeros(10.42);

for ii=1:10
path(ii,1:2)=[starty,starth];

endy=12;
endh=12;
pick=rand;
while pick==0
    pick=rand;
end

for i=1:26
    pick=pick-sumq(i);
    if pick<0
        index=i;
        break;
    end
end
Copy the code

3. Operation results



Fourth, note

Version: 2014 a