www.pudn.com > anttsp.rar > as_pher_update.m, change:2008-04-20,size:1106b


function pher=as_pher_update(pher_evap_rate,city_num,ant_num,dist,as_type,pher,ant) 
%蚂蚁系统信息素更新 
pher=pher*pher_evap_rate;                           %信息素蒸发 
switch as_type 
    case 'ant_density'   
        for i=1:ant_num                             %蚁密系统 
            for j=1:city_num 
                m=ant(i).tour(j); 
                n=ant(i).tour(j+1); 
                pher(m,n)=pher(m,n)+1; 
                pher(n,m)=pher(m,n); 
            end 
        end 
    case 'ant_quantity' 
        for i=1:ant_num                             %蚁量系统 
            for j=1:city_num 
                m=ant(i).tour(j); 
                n=ant(i).tour(j+1); 
                pher(m,n)=pher(m,n)+1/dist(m,n); 
                pher(n,m)=pher(m,n); 
            end 
        end 
    case 'ant_cycle' 
        for i=1:ant_num                             %蚁周系统 
            for j=1:city_num 
                m=ant(i).tour(j); 
                n=ant(i).tour(j+1); 
                pher(m,n)=pher(m,n)+1/ant(i).length; 
                pher(n,m)=pher(m,n); 
            end 
        end 
end