• Aucun résultat trouvé

Towards development of a hybrid discrete graph-based ant colony optimization algorithm with an antibody-based immune programming algorithm

N/A
N/A
Protected

Academic year: 2021

Partager "Towards development of a hybrid discrete graph-based ant colony optimization algorithm with an antibody-based immune programming algorithm"

Copied!
7
0
0

Texte intégral

(1)

Publisher’s version / Version de l'éditeur:

Vous avez des questions? Nous pouvons vous aider. Pour communiquer directement avec un auteur, consultez la

première page de la revue dans laquelle son article a été publié afin de trouver ses coordonnées. Si vous n’arrivez pas à les repérer, communiquez avec nous à PublicationsArchive-ArchivesPublications@nrc-cnrc.gc.ca.

Questions? Contact the NRC Publications Archive team at

PublicationsArchive-ArchivesPublications@nrc-cnrc.gc.ca. If you wish to email the authors directly, please see the first page of the publication for their contact information.

https://publications-cnrc.canada.ca/fra/droits

L’accès à ce site Web et l’utilisation de son contenu sont assujettis aux conditions présentées dans le site LISEZ CES CONDITIONS ATTENTIVEMENT AVANT D’UTILISER CE SITE WEB.

Report (National Research Council of Canada. Radio and Electrical Engineering

Division : ERB), 2005-04-21

READ THESE TERMS AND CONDITIONS CAREFULLY BEFORE USING THIS WEBSITE.

https://nrc-publications.canada.ca/eng/copyright

NRC Publications Archive Record / Notice des Archives des publications du CNRC :

https://nrc-publications.canada.ca/eng/view/object/?id=8d429dfe-6b98-4dcd-88e3-384ac5e4eede

https://publications-cnrc.canada.ca/fra/voir/objet/?id=8d429dfe-6b98-4dcd-88e3-384ac5e4eede

NRC Publications Archive

Archives des publications du CNRC

For the publisher’s version, please access the DOI link below./ Pour consulter la version de l’éditeur, utilisez le lien DOI ci-dessous.

https://doi.org/10.4224/8913779

Access and use of this website and the material on it are subject to the Terms and Conditions set forth at

Towards development of a hybrid discrete graph-based ant colony

optimization algorithm with an antibody-based immune programming

algorithm

(2)

National Research Council Canada Institute for Information Technology Conseil national de recherches Canada Institut de technologie de l'information

Towards Development of a Hybrid Discrete

Graph-Based Ant Colony Optimization Algorithm

with an Antibody-Based Immune Programming

Algorithm *

Barton, A.

April 2005

* published as NRC/ERB-1126. April 21, 2005. 5 pages. NRC 48119.

Copyright 2005 by

National Research Council of Canada

Permission is granted to quote short excerpts and to reproduce figures and tables from this report, provided that the source of such material is fully acknowledged.

(3)

Towards Development of a Hybrid

Discrete Graph-based Ant Colony Optimization Algorithm

with an Antibody-based Immune Programming Algorithm

Alan J. Barton

Integrated Reasoning Group Institute for Information Technology National Research Council Canada

alan.barton@nrc-cnrc.gc.ca

ABSTRACT

An attempt is made to improve swarm-based optimization algorithms (SBOA) through an investigation and develop-ment in C of the following: i) Random Algorithm, ii) Im-mune Programming Algorithm (IP), iii) Ant Colony Opti-mization Algorithm (ACO), and iv) Hybridized ACO and IP. Preliminary experiments are performed and reported for both integer (Z) stack-based and real (R) model-based prob-lem representations.

Keywords

optimization, approximation, stigmergy, emergence

1.

INTRODUCTION

We should not rely on careful examinations, we should avoid the need for it. – J.W. Tukey, 19771

Nature inspires. Biology inspires. Computer Science may use such inspiration for the construction of new algorithms. In particular, foraging ants and the human immune system [3] have lead to the ACO [1], [7] and IP [5], [2], [8] algorithms, respectively. This work hopes to provide an explication of re-lated algorithms from a Computer Science perspective with the intent of contributing to the development of a hybrid ant immune-system algorithm.

Given an input/output mapping, one becomes interested in determining an apriori unknown exact-form analytical func-tion that fits the data. There are many possible classical ∗Final Project for the course COMP5900Z entitled Swarm Intelligence at Carleton University

†Master of Computer Science (in progress)

1

John W. Tukey was referring to the fact that plotted data (e.g. a scatter plot) should be clearly presented to a reader when attempting to argue for a particular perspective[6].

Real Representation 1 2 3 4 ... L 4.6 3.1 8.1 -6.0 ... 7.4 Integer Representation 1 2 3 4 ... L 0 2 1 1 ... 0

Figure 1: Two possible representations having length L. Left: Z-Antibody Right: R-Antibody

Inst. Code Description

nop 0 No Operation (enables antibodies of varying length)

dup 1 Duplicate the top of the stack (x ⇒ xx) ste 2 Swap the top two elements of the stack

(xy ⇒ yx)

mult 3 Multiply the top two elements of the stack (23 ⇒ 6)

add 4 Add the top two elements of the stack (23 ⇒ 5)

over 5 Duplicate the second item on the stack (xy ⇒ yxy)

etpo 6 The top of the stack is replaced with ex

(x ⇒ ex

). This was not in [5].

Table 1: A Z-Antibody may be decoded into stack-based instructions using this instruction set

optimization algorithms that could be used (least squares being one). There are also recent advances in local-search based simple agents using stigmergy (environment-based mem-ory) that could potentially be applied if a suitable problem representation exists.

2.

PROBLEM REPRESENTATION

At least two representations may be used (Fig.1), integer-based, which shall be referred to as a Z-Antibody and real-based, which shall be referred to as an R-Antibody. Decod-ing the representation in order to solve the problem may be done in at least two ways. The Z-Antibody’s elements may be interpreted as op-codes from an instruction set [5], but not sufficiently fine-grained in order to be useful for dis-covering low error models, while the R-Antibody’s elements may be considered as either op-codes from an instruction set or constants in a model.

(4)

in (Fig.1), it may be decoded as the stack-based evaluation function (using the instruction set in Table.1).

nop ste dup dup (1)

For example, for an R-Antibody of length 4, with values as in (Fig.1), it may be decoded as the model-based evaluation function using the model

a· eb·x+ c · x + d

where antibody= [a, b, c, d]. 4.6 · e3.1·x

+ 8.1 · x + −6.0 (2)

It becomes apparent that the latter form is easier to read and interpret, inclining one to favour the model-based ap-proach over the stack-based apap-proach. Irrespective of this, Z-Antibody and R-Antibody based algorithms were devel-oped and investigated (albeit briefly for some).

3.

ALGORITHMS

The following algorithms were implemented in the program-ming language C. The Ant Colony Optimization subsection begins to explain how the mapping is made from Z- and R-Antibodies to patches and nests.

3.1

Random

Completely randomly generate populations of Z- and R-Antibodies. This algorithm may be used as a baseline over which all other algorithms should enhance.

Algorithm 1. Random(m, seed, tmax) 1 f o r ( t ← 1 ) t o ( t max ) do 2 f o r ( k ← 0 ) t o ( num ants −1) do 3 b u i l d s o l u t i o n f o r a n t ( k ) 4 c o m p u t e c o s t o f s o l u t i o n f o r a n t ( k ) 5 r e c o r d B e s t S o l u t i o n F o u n d S o F a r ( ) 6 endfor 7 endfor — End of Algorithm —

3.2

Immune Programming

The Immune Programming algorithm as explained in [5] was implemented with the help of the PGAPack library [4]. The algorithm was enhanced in order to support various forms of elitism, which was not used in [5]. For example, from one repertoire to the next, one may keep r best affinity-valued antibodies. The IP algorithm was also enhanced to incorporate the idea of a maximum number of iterations, which was not used in [5].

Algorithm 2. IP

(n,r,seed,tmax,P r(Rep),P r(Hyp),P r(Clo)) 1 i n i t p o p o f a n t i b o d i e s ( ) do 2 f o r ( i←0 ) t o s i z e ( r e p e r t o i r e ) do 3 a d d n e w a n t i b o d y t o r e p e r t o i r e ( ) 4 f o r ( j←0 ) t o l e n ( new antibody ) do 5 new antibody [ j ] ← 6 [ minOpCode . . maxOpCode ] 7 endfor 8 endfor 9 endFcn 10 e v a l u a t e A f f i n i t y O f A l l A n t i b o d i e s ( ) 11 do 12 // E l i t i s m was n o t i n o r i g i n a l a l g o r i t h m 13 c o p y r B e s t I n d i v i d u a l s T o N e w R e p e r t o i r e ( ) 14 i ← 0 // i n d e x i n t o o l d r e p e r t o i r e 15 while ( 16 c o n s t r u c t i o n O f N e w R e p e r t o i r e N o t C o m p l e t e ) 17 do 18 i f ( i = s i z e ( o l d R e p e r t o i r e ) ) do 19 i ← 0 20 endif 21 i f ( rand ( ) ≤ Pr ( Rep ) ) do 22 generateRandomAntibody ( ) do 23 f o r ( j←0 ) t o l e n ( new antibody ) do 24 new antibody [ j ] ← 25 [ minOpCode . . maxOpCode ] 26 endfor 27 endFcn 28 addNewRandAntibodyToNewRepertoire ( ) 29 e l s e do 30 i ← i + 1 31 // c l o n e or mutate ? 32 i f ( rand ( ) ≤ a f f i n i t y O f A n t i b o d y ( i ) ) do 33 cloneAntibodyToNewRepertoire ( i ) 34 i f ( rand ( ) > Pr ( Clo ) ) do 35 mutateAntibodyInNewRepertoire ( i ) 36 endif 37 endif 38 endelse 39 endwhile 40 // c o n s t r u c t i o n O f N e w R e p e r t o i r e C o m p l e t e 41 e v a l u a t e A f f i n i t y O f A l l A n t i b o d i e s ( ) 42 while ( notDone ) 43 // t o o S i m i l a r | | noChange | | m a x I t e r a t i o n s — End of Algorithm —

3.3

Ant Colony Optimization

The ACO algorithm as applied to the Quadratic Assign-ment Problem in [1] was impleAssign-mented and modified for the purposes outlined above. Fig.2 presents possible ways for ants to forage over patches in a world, remembering their graph traversal histories, and providing solutions at the end of their life. An ant dies when it gets to the other side of the world (the world is flat) or when it reaches food and gorges itself to death. Fig.3 demonstrates another possi-ble representation where an ant is born on any patch and walks either east or west (wrapping around the world) un-til it comes to its own nest and subsequently dies. Ants must make a decision about which patch to move to based on pheromone intensity on the patches in the neighbouring nest in the direction of their world tour.

Fig.3 shows a Z-Antibody mapped onto the ant world, where Nest i is position i in the Z-antibody. For example, if an ant is standing on a patch that has a mapped value coming from a Z-Antibody, then that may be decoded using the instruction set in Table.1.

(5)

Ant 1 Ant 3 Ant 2 Ant 4 Ant 5 Nest Food Ant 1 Ant 3 Ant 2 Ant 4 Ant 5 Nest Nest Ant 8 Ant 9 Ant 6 Ant 10 Ant 7

Figure 2: Two possible nest/food configurations. Left: 1 nest and one food source, where ants build a solution as they traverse the graph from left to right. Right: 2 nests (and no food) where ants sim-ply move away from their respective nests, thereby building a solution. This variant may have ψ ants at Nest 1 and n − ψ at Nest 2.

Ant 1

Ant 3

Ant 2

Ant 4 Ant 5

Nest 1 Nest 2 Nest 3 Nest 4

Figure 3: Ants foraging and making decisions about what patch to move to. In this scheme, every ant may stand on a patch irrespective of how many ants are already standing on the patch, but the patches only exist in the world inside of nests.

Algorithm 3. ACO (n, seed, α, β, ρ, tmax, τ0, Q) 1 a s s i g n i n i t i a l p h e r o m o n e l e v e l s ( ) 2 p l a c e a n t s o n l o c a t i o n s ( ) 3 p ← c o n s t r u c t A P e r m u t a t i o n ( ) 4 f o r ( t ← 1 ) t o ( t max ) do 5 // p l a c e a n t s o n l o c a t i o n s ( ) ? 6 randomize ( p ) 7 f o r ( k ← 0 ) t o ( num ants −1) do 8 // c o n s i d e r a n t s i n random o r d e r 9 b u i l d s o l u t i o n f o r a n t ( p [ k ] ) 10 endfor 11 f o r ( k ← 0 ) t o ( num ants −1) do 12 c o m p u t e c o s t o f s o l u t i o n f o r a n t ( k ) 13 endfor 14 recordBestSolutionFoundByAnAnt ( ) 15 u p d a t e p h e r o m o n e t r a i l s ( ) 16 endfor — End of Algorithm —

3.4

Hybrid

This algorithm is a hybridization of ACO and IP in the sense that ACO is used, but every resetF req time steps a

com-Nest 1 Nest 2 Nest 3 Nest 4

0 1 2 1 0 1 2 1 2 0 0 2

Figure 4: Z-Antibody mapped onto the ant World, where Nest i represents position i in the antibody.

pletely new mapping on the world is performed. This new generation of map values may be done in the same manner as upon initialization (e.g. uniform random distribution) or may be done based on the learned pheromone levels of the ants, thereby passing learned information from one world map to the next. It is hoped that the ants have learned good mapping values, from which nearby values could be generated (a local search heuristic). This is in the spirit of IP w.r.t. the generation of new antibodies based on their affinity to the antigen, which represents the problem (in-put/output mapping) that is being attempted to be solved.

Algorithm 4. Hybrid

(n, seed, resetFreq, α, ρ, L, P , tmax, τ0, Q) 1 a s s i g n i n i t i a l p h e r o m o n e l e v e l s ( ) 2 p l a c e a n t s o n l o c a t i o n s ( ) 3 p ← c o n s t r u c t A P e r m u t a t i o n ( ) 4 f o r ( t ← 1 ) t o ( t max ) do 5 randomize ( p ) 6 f o r ( k ← 0 ) t o ( num ants −1) do 7 // c o n s i d e r a n t s i n random o r d e r 8 b u i l d s o l u t i o n f o r a n t ( p [ k ] ) do 9 f o r ( i ← 0 t o ( l e n ( a n t i b o d y ) ) do 10 do 11 j ← n e x t I n d e x B a s e d O n D i r e c t i o n ( ) 12 Pr ( patch ) ← basedOnPheromone ( )

13 while ( rand ( ) < Pr ( patch )

14 a n t s [ p [ k ] ] . h i s t o r y [ i ] ← j 15 // i . e . a l l o w a n t t o move t o p a t c h 16 // ( a s s i g n opcode t o a n t ’ s s o l u t i o n 17 endfor 18 endFcn 19 endfor 20 f o r ( k ← 0 ) t o ( num ants −1) do 21 c o m p u t e c o s t o f s o l u t i o n f o r a n t ( k ) 22 endfor 23 recordBestSolutionFoundByAnyAnt ( ) 24 u p d a t e p h e r o m o n e t r a i l s ( ) 25 i f ( r e s e t f r e q > 0 do 26 i f ( t%r e s e t f r e q =0) do 27 u p d a t e m a p a n d p h e r o m o n e l e v e l s ( ) 28 endif 29 endif 30 endfor

(6)

New Patch Generation

Nest 1 Nest 2 Nest 3 Nest 4

8.12 0.002 8.1 5.57 7.003 -10.29 4.6 10.83 3.1 2.99 9.07 -6.0 -1.4 Patch Expiration

Figure 5: A static snapshot of a dynamic ant World with a mapping to the reals. N- and R-antibodies may be represented in this world.

— End of Algorithm —

Fig.5 demonstrates a static snapshot of how an R-antibody may be computationally evolved from ants and immune-system concepts. A new patch representing an additional real value on an attribute in the search space that the ants are exploring may be generated in many possible ways. The current implementation generates a new real value com-pletely randomly, but a more local based generation strat-egy, such as generating based on a gaussian distribution of mean µ and standard deviation σ, may lead to faster con-vergence.

4.

EXPERIMENTAL RESULTS

All of the algorithms were implemented and executables run. Only the results of the most complex implementation are reported.

Fig.6 shows the best antibody found for a series of 100 exper-iments where all parameters were kept constant except the seed, which was calculated based on computer clock time. In particular, the number of ants was 200, the maximum number of iterations was 200, the mapping graph would be regenerated completely at randomly every 4 iterations (in order to give the ants enough time to search), α was 2, ρ was 0.1, τ0was 0.1, the strategy for updating the pheromone

lev-els was based on normalization, the R-antibody had length 4 and the number of patches per nest was fixed at 20. The overall distribution of solution costs is shown in Fig.7. It can be seen to have a skewed distribution with average solution costs in the neighbourhood of 1.

The best solution (Fig.6) was found at t = 153, with a so-lution cost of 0.224718 and Seed= 1113951307. The ant started at Nest 0, and moved in an westerly direction. The complete graph traversal history is [19, 17, 4, 12], where the corresponding mapped R-Antibody (labelled as antibody1)

0 0.5 1 1.5 2 2.5 0 20 40 60 80 100 120 140 160 180 200 Solution Value

Iteration Time of Best Solution Solution Values over Experiments

Figure 6: 100 trials with fixed algorithm parame-ters, except seed. Good solutions (models fitting the antigen very closely) are distributed throughout the space of time steps. Demonstrating the stochas-tic nature of the hybrid algorithm.

Solution Value Frequency 0.0 0.5 1.0 1.5 2.0 0 5 10 15 20 25 30

Figure 7: Distribution of 100 best solutions from trials of the hybrid algorithm with a fixed parameter set (except varying seed). Binning via Scott’s Rule.

(7)

-0.02 0 0.02 0.04 0.06 0.08 0.1 0.12 0 2 4 6 8 10 12 14 16 18 20

Figure 8: Residuals for best fit (out of 100 trials) to the input/output mapping problem (f (x) = x) for x= 1, 2, 3, ..., 20). x f(x) antibody1 antibody2 1 1 1.103267 0.883816 2 2 2.082888 1.890011 3 3 3.077486 2.896206 ... ... ... ... 19 19 18.991054 18.995326 20 20 19.985652 20.001521 x= 10.5 cost 0.224718) 0.301971) seed 1113951307 1113926247 Table 2: First 6 values of the 20 (x,y) sampled point values used to build the solution costs

[4.992523, −5.565050, 0.994598, 0.093692]. These mapping values represent the constants in Eqn(2) above. This an-tibody solution has the residuals as indicated in Fig.8. It is interesting that the residuals display such a high correlation, as this indicates a further area for antibody improvement. Possibly, if the hybrid algorithm had tmax increased, the

solution cost would be able to decrease in this case. The model that was learnt is not similar to the expected solution. That is, the expected form of the solution, based on the generated data, is f (x) = a·x, but we were giving the hybrid algorithm a vastly different underlying data model assumption (Eqn(2)) in order to investigate the robustness of the hybrid algorithm with respect to underlying incorrect assumptions.

It is interesting, that one experiment of higher cost seems to model the problem much better. For example, antibody2 in Table.2 can be seen to have discovered a much better solution (even though it is of higher cost than antibody1) be-cause it is [0.313425, −6.967681, 1.006195, −0.122379], where the first and fourth co-ordinates are closer to 0.

5.

CONCLUSIONS

A number of algorithms were implemented with the goal of developing a hybrid ACO immune-system algorithm. Pliminary results look promising (further experiments are

re-quired to more fully cover the space of possible algorithm pa-rameters) as the hybrid algorithm was able to find vastly dif-ferent models to fit the data (as one would expect). Future extensions include i) incorporating the concept of dynamic nest size, and ii) investigating other local/global heuristics (e.g. w.r.t. a) pheromone levels, b) patch generation/elimi-nation, c) number of ants based on the number of patches/n-odes in the world/graph) that may help improve convergence time and/or solution cost.

6.

ACKNOWLEDGMENTS

The author would like to thank Prof. Tony White for teach-ing the course and Julio Vald´es, Fazel Famili and Bob Or-chard from the National Research Council (NRC), Insti-tute for Information Technology (IIT), Integrated Reasoning Group for their kind support.

7.

REFERENCES

[1] E. Bonabeau, M. Dorigo, and G. Theraulaz. Swarm Intelligence From Natural to Artificial Systems. Number ISBN 0-19-513159-2 in Sante Fe Institute Studies in the Sciences of Complexity. Oxford University Press, 198 Madison Avenue, New York, New York 10016, 1999. [2] L. N. D. Castro and F. J. V. Zuben. The clonal

selection algorithm with engineering applications. Workshop on Artificial Immune Systems and their Applications in Proceedings of Genetic and

Evolutionary Computation Conference (GECCO), July 2000.

[3] J. Farmer, N. Packard, and A. Perelson. The immune system, adaptation, and machine learning. Physica D, 22:187–204, October 1986.

[4] D. Levine. Users guide to the PGAPack Parallel Genetic Algorithm library. Argonne National Laboratory. Mathematics and Computer Science Division, January 1996.

http://www.mcs.anl.gov/pgapack.html.

[5] P. Musilek, A. Lau, M. Reformat, and L. Wyard-Scott. Immune programming. Dept. of Electrical and

Computer Engineering, University of Alberta, April 2004.

[6] J. W. Tukey. Exploratory Data Analysis. 1977. [7] Z. Wang and B. Feng. Classification rule mining with

an improved ant colony algorithm. AI 2004. Lecture Notes in Artificial Intelligence, LNAI 3339:357–367, December 2004.

[8] S. Wierzcho´n and U. Ku˙zelewska. Stable clusters formation in artificial immune system. First International Conference on Artificial Immune Systems, pages 68–75, 2002.

Figure

Figure 4: Z -Antibody mapped onto the ant World, where Nest i represents position i in the antibody.
Figure 5: A static snapshot of a dynamic ant World with a mapping to the reals. N - and R -antibodies may be represented in this world.
Figure 8: Residuals for best fit (out of 100 trials) to the input/output mapping problem (f(x) = x) for x = 1, 2, 3, ..., 20)

Références

Documents relatifs

One of the interesting techniques for leader election is used in the WBS (Wait Before Starting) algorithm, in which each node in the network will wait for a time corresponding to

In this article I will give an improvement in space and in time of the algorithm says : we know that there exist several methods to find the Hamiltonian cycles such as the Monte

running CPU time in seconds; rp: denotes the ratio y c + where y + is the capacity level where the algorithm detects that the periodicity level y ∗ is reached; vrs: number of

The left panel of Fig 2 shows a comparison of the optimized parameters obtained by a Fourier analysis to the one obtained by Algorithm 1 using as probing vectors the sine frequencies

This paper extends a hybrid evolutionary approach, which applies a local optimization method, by taking instances into ac- count in order to reduce premature convergence

In this paper, we propose a hybrid recommen- dation algorithm which considers two basic roles of social tags: (i) an accessorial tool helping users organize items; (ii) a bridge

Due to the fact that heuristic algorithms give only approximate results it is unlikely to obtain fitness function equal to 0, however presented results, especially from Ant

This paper presents a hybridization of the Ant Colony Algorithm and a Complete Local search with Memory heuristic, in order to maximize as much as possible; the free time