Page 62 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 62
50 Chapter 1
Figure 1-27. Iteration (vs.) Best Cost selected by the 4 ants
6.3 M-program for Finding the Optimal Order using Ant
Colony Technique fo r the Specifications given in the
Section 6.2
________________________________________________________
antcolonygv.m
%Consider the problem of finding the optimum order in which the numbers from 1 to 8
are arranged so that
%the cost of that order is decreased .Cost of the particular order is computed using the
two matrices A and B as described below.
%The cost of the order [3 2 1 5 7 2 4 6 8] is computed as the sum of the product of
values
%obtained from the positions (1,3) or (3,1),(2,2),(3,1) ,(4,5) or (5,4) , (5,7) or (7,5) ,(6,2),
(7,4) and (8,6) of the matrices A and B .
%Cost ([3 2 1 5 7 2 4 6 8] ) = a6*b6 + a3*b3 + a6*a6 + a14*b14 + a26*b26 + a17*b17
+a25*b25 + a36*b36 see Matrix A and Matrix B
%Form the matrices given below
matA=diag([ones(1,9)*9]);