Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Ant Colony Optimization ACOUCP.m
Replies: 1   Last Post: Dec 20, 2013 1:01 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ahmed Hakim

Posts: 22
Registered: 1/22/09
Re: Ant Colony Optimization ACOUCP.m
Posted: Dec 20, 2013 1:01 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Ahmed Hakim" <general_ahmed@hotmail.com> wrote in message <khknen$gsn$1@newscl01ah.mathworks.com>...
> Hello Guys,
>
> I was searching the google about Ant Colony Optimization Matlab Code and I found this nice code.
>
> I was unlucky to find it in chinese language, It was my first problem.
> I tried to translate it as I can.
>
> Now I am working to understand its concept but I have some problems, if anyone here could help me about ant colony optimization I will be grateful.
>
> I will paste the code here (in its language) and then I will type my questions:
>
> ____________________________________________________________________________
> function [BESTX,BESTY,ALLX,ALLY]=ACOUCP(K,N,Rho,Q,Lambda,LB,UB,Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB)
> %% ?????????????????PID?????
> %% ??????
> % K ????
> % N ????
> % Rho ??????????0?1???????0.7?0.95
> % Q ??????????0?????1??
> % Lambda ?????????0?1???????0.1?0.5
> % LB ????????M×1???
> % UB ????????M×1???
> % Num ????????????????
> % Den ????????????????
> % Delay ????
> % ts ??????
> % StepNum ?????
> % SigType ?????1??????2??????3??????
> % PIDLB PID???????????
> % PIDUB PID???????????
> %% ??????
> % BESTX K×1???????????M×1?????????????
> % BESTY K×1???????????????????
> % ALLX K×1???????????M×N?????????????
> % ALLY K×N????????????????
>
> %% ???????
> M=length(LB);%???????
> %???????
> X=zeros(M,N);
> for i=1:M
> x=unifrnd(LB(i),UB(i),1,N);%%X?3*10????????????????10?????
> X(i,:)=x;
> end
> %???????
> ALLX=cell(K,1);%???????????M×N???????????
> ALLY=zeros(K,N);%K×N?????????????
> BESTX=cell(K,1);%???????????M×1?????????????
> BESTY=zeros(K,1);%K×1???????????????????
> k=1;%????????
> Tau=ones(1,N);%??????
> Y=zeros(1,N);%??????
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %?????
> NN=5;
> Rho_min=0.1;
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %% ????????
> while k<=K
> YY=zeros(1,N);
> for n=1:N
> x=X(:,n);
> [J,u,yout,error]=PIDOBJ(x(1),x(2),x(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> YY(n)=J;
> end
> maxYY=max(YY);
> temppos=find(YY==maxYY);
> POS=temppos(1);
> %??????
> for n=1:N
> if n~=POS
> x=X(:,n);
> [J,u,yout,error]=PIDOBJ(x(1),x(2),x(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> Fx=J;
> mx=GaussMutation(x,LB,UB);
> [J,u,yout,error]=PIDOBJ(mx(1),mx(2),mx(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> Fmx=J;
> if Fmx<Fx
> X(:,n)=mx;
> Y(n)=Fmx;
> elseif rand>1-(1/(sqrt(k)))%%????????????????????????????
> X(:,n)=mx;
> Y(n)=Fmx;
> else
> X(:,n)=x;
> Y(n)=Fx;
> end
> end
> end
> for n=1:N
> if n~=POS
> x=X(:,n);
> [J,u,yout,error]=PIDOBJ(x(1),x(2),x(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> Fx=J;
> mx=GaussMutation(x,LB,UB);
> [J,u,yout,error]=PIDOBJ(mx(1),mx(2),mx(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> Fmx=J;
> if Fmx<Fx
> X(:,n)=mx;
> Y(n)=Fmx;
> elseif rand>1-(1/(sqrt(k)))%%???????????????????????????????
> X(:,n)=mx;
> Y(n)=Fmx;
> else
> X(:,n)=x;
> Y(n)=Fx;
> end
> end
> end
>
> %???????????
> for n=1:N
> if n~=POS
> x=X(:,n);
> r=(K+k)/(K+K);
> p=randperm(N);%%?1?N??????
> t=ceil(r*N);%?????????????r*N?????
> pos=p(1:t);%%?p??t???????
> TempTau=Tau(pos);
> maxTempTau=max(TempTau);
> pos2=find(TempTau==maxTempTau);
> pos3=pos(pos2(1));
> x2=X(:,pos3(1));%%%?????????????????
> x3=(1-Lambda)*x+Lambda*x2;%%
> [J,u,yout,error]=PIDOBJ(x(1),x(2),x(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);
> Fx=J;
> [J,u,yout,error]=PIDOBJ(x(1),x(2),x(3),Num,Den,Delay,ts,StepNum,SigType,PIDLB,PIDUB);%%%????????????x(1),x(2),x(3)??x3(1),x3(2),x3(3)
> Fx3=J;
> if Fx3<Fx
> X(:,n)=x3;
> Y(n)=Fx3;
> elseif rand>1-(1/(sqrt(k)))
> X(:,n)=x3;
> Y(n)=Fx3;
> else
> X(:,n)=x;
> Y(n)=Fx;
> end
> end
> end
> %????????
> Tau=Tau*(1-Rho);
> maxY=max(Y);
> minY=min(Y);
> DeltaTau=(maxY-Y)/(maxY-minY);
> Tau=Tau+Q*DeltaTau;
> ALLX{k}=X;
> ALLY(k,:)=Y;
> minY=min(Y);
> pos4=find(Y==minY);
> BESTX{k}=X(:,pos4(1));
> BESTY(k)=minY;
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> %??????????
> if k>NN
> if BESTY(k)>=BESTY(k-NN)
> if 0.95*Rho>=Rho_min
> Rho=0.95*Rho
> else
> Rho=Rho_min;
> end
> end
> end
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> disp(k);
> k=k+1;
> end
>
> ___________________________________________________________________________
>
> I concluded from this code that it is an improved Ant colony algorith that uses Mutation (guass mutation) to be having the genetics characteristics.
>
> in the following portion of code:
> I can not define how the ant can find its next path pheromone (largest) where is the equation that is known as random probalistic used always ???
>
> _________________________________________________________________________
> %???????????
> for n=1:N
> if n~=POS
> x=X(:,n);
> r=(K+k)/(K+K);
> p=randperm(N);%%?1?N??????
> t=ceil(r*N);%?????????????r*N?????
> pos=p(1:t);%%?p??t???????
> TempTau=Tau(pos);
> maxTempTau=max(TempTau);
> pos2=find(TempTau==maxTempTau);
> pos3=pos(pos2(1));
> x2=X(:,pos3(1));%%%?????????????????
> x3=(1-Lambda)*x+Lambda*x2;%%
> __________________________________________________________________________
>
> what is the use of Lamda ???
>
>
> what kind of equation you use to update the DeltaTau in the following
> _________________________________________________________________________
> %????????
> Tau=Tau*(1-Rho);
> maxY=max(Y);
> minY=min(Y);
> DeltaTau=(maxY-Y)/(maxY-minY);
> Tau=Tau+Q*DeltaTau;
> ALLX{k}=X;
> ALLY(k,:)=Y;
> minY=min(Y);
> pos4=find(Y==minY);
> BESTX{k}=X(:,pos4(1));
> BESTY(k)=minY;
> ___________________________________________________________________
>
>
> I hope to find a paper in english having this algorithm
> or if anyone has understood it and has a refernce equation , please help me
>
> Thanks in advance








NO REPLIESSSSSS??????????!!!!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.