You are on page 1of 19

(ACO) Ant Colony Optimization

" "
Web Page Classification with an Ant Colony Algorithm


2010 - 2009

( : : . (

: ACO

.1.1

.2.1

.3.1

.4.1 )ACO) Ant Colony Optimization

.5.1 )(TSP

:
Web Page Classification with an Ant Colony Algorithm
+
.1.2
.2.2
.3.2
.4.2 Ant-Miner
.5.2
1.5.2 Experimental Setup
2.5.2
3.5.2 C5.0
.6.2

9
10
11
11
13
15
15
16
18
20
22

( : : . (

:

,Combinatorial Optimization
:


81 .

1024.


. .
)(
.

.1 :


. ,Genetic Algorithms
Simulated Annealing
.

.2 :
.

.

. :
. . . . . .
. :
.
. :
.
. :
.

.3 :

)(
.
) (
, .

,
.

)( .

.
.

3

( : : . (

. .

.

.4 ):ACO) Ant Colony Optimization



) (Combinatorial Optimization
.


. ACO
) meta-heuristic). Colorni, Dorigo, Maniezzo
TSP
.
. .


.

.
.
Pheromone ,
Pheromone .
)( .


.

) ( .

,
.
,
) (
) ( .
. ) (
.

.
.
.
) (ACO ,
, ,
.
, .
)
(Simulated annealing )(Tabu search
4

( : : . (

)
(Simulated annealing ) (Neural network /14/
, /3/ ) ,(Tabu search
/125/
) (Simulated annealing
.
,
).(Tabu search

.5 ):(TSP

Heuristic Search
:
(t(0 , (t(1

, ) (t .t
k

Tabu k

Visibility
i j :

j (t

(t :

k
[Tij (t )] . [nij ]

if j allowedk
(
t
)
=
pij k allowedk [Tik (t )] . [nik ]

Trail


otherwise
0

Visibility ,


.
t .1 , 0

:
Tij (t + n) = Tij(t) + Tij
:

Q if the kth ant uses edge(i, j ) in its tour



Tree Structure
Pointers

(between
time
t and t + n
)
T ijk = Lk
:
Struct ++C
>#include <iostream
otherwise
0
>#include <math.h
;using namespace std
int Distance[6][6]={{0,0,0,0,0,0},
{0,0,5,1,8,4},

( . : : (
{0,0,0,3,5,2},
{0,0,0,0,7,9},
{0,0,0,0,0,6},
{0,0,0,0,0,0},};
int n=5;
double Alpha=3, Beta=5, Q=5;
double Ro=0.01;
int Ant=100;
struct tree
{
int Node, Length, Ants;
double Pheromon, Pr;
tree *Son, *Next, *Father;
};
tree *Tree=new tree;
double round(double x)
{
if (ceil(x)-x<0.5) return ceil(x); else return (int) x;
}
double Sum_Son_Node(tree *T)
{
double P=0.0;
tree *t;
t=T->Son;
do
{
P+= pow(1.0/(double) Distance[T->Node][t->Node],(double)
Alpha)*pow(t->Pheromon,(double)Beta);
t=t->Next;
}while (t!=NULL);
return P;
}
void Distribut_Ants_Son_Node(tree *T)
{
double P=0.0;
tree *t;
P=Sum_Son_Node(T);
t=T->Son;
do
{
t->Ants=round(T->Ants*
pow(1.0/(double) Distance[T->Node][t->Node],
(double) Alpha)*
pow(t->Pheromon,(double)Beta)/P);
t=t->Next;
}while (t!=NULL);
}

void Pheromon_Son_Node(tree *T)


{
tree *t;
t=T->Son;
do
{
t->Pheromon=t->Pheromon*Ro+t->Ants*Q/t->Length;
t=t->Next;
}while (t!=NULL);

( . : : (
}
void Eval_Nodes(tree *T)
{
Distribut_Ants_Son_Node(T);
Pheromon_Son_Node(T);
}
void Print_Path(tree *T)
{
if (T->Father!=NULL) Print_Path(T->Father);
cout<<T->Node<<"("<<T->Ants<<")
";
}
void Explore_Path(tree *T)
{
if (T->Son==NULL)
Print_Path(T);
else
Explore_Path(T->Son);
cout<<endl;
if (T->Next!=NULL) Explore_Path(T->Next);
}
tree *New_Node()
{
tree *T=new tree;
T->Son=NULL;
T->Next=NULL;
T->Father=NULL;
T->Length=0;
T->Pheromon=1.0;
T->Pr=0;
T->Ants=0;
return T;
}
bool Test_Path(tree *T, int i)
{
bool b=(T->Node==i);
while (T->Father!=NULL)
{
if (T->Father->Node==i) b=true;
T=T->Father;
}
return b;
}

void Add_Next_Node(tree *T1,tree *T2,int i,int j)


{
int l=j+1;
while ((Test_Path(T1,l))) l++;
if ((l<=n) && (Distance[i][l]!=0))
{
T2->Next=New_Node();
T2->Next->Length=T1->Length+Distance[i][l];
T2->Next->Node=l;

( . : : (
T2->Next->Father=T1;
Add_Next_Node(T1,T2->Next,i,l);
} else if (l<n) Add_Next_Node(T1,T2,i,l);
};
void Add_Son_Node(tree *T,int i, int j)
{
if ((Distance[i][j]!=0)&&(!Test_Path(T,j)))
{
T->Son=New_Node();
T->Son->Length=T->Length+Distance[i][j];
T->Son->Node=j;
T->Son->Father=T;
}
else if (j<n) Add_Son_Node(T,i,j+1);
if ((T->Son!=NULL)&& (T->Son->Node<n)) Add_Next_Node(T,T>Son,i,T->Son->Node);
if (T->Son!=NULL) Eval_Nodes(T);
};
void Form_Path(tree *T)
{
if (T->Ants>0) Add_Son_Node(T,T->Node,1);
if (T->Son!=NULL) Form_Path(T->Son);
if (T->Next!=NULL) Form_Path(T->Next);
}
void init()
{
for (int i=1;i<5;i++)
for (int j=i+1;j<=5;j++) Distance[j][i]=Distance[i][j];
Tree=New_Node();
Tree->Node=1;Tree->Ants=Ant;
}
//Resend another set of ants
void send_ants(tree *t)
{
if(t->Son!=NULL)
Eval_Nodes(t);
else
send_ants(t->Son);
if (t->Next!=NULL)
send_ants(t->Next);
}
void main()
{
init();
Form_Path(Tree);
//Resend ants 10 times
for(int i=0;i<10;i++)
send_ants(Tree);
Explore_Path(Tree);
{

( : : . (


Web Page Classification with an Ant Colony Algorithm
: -
,
C5.0 Yahoo BBC
.
Attributes .
:
:C5.0

,Information Entropy
Classification Ross Quinlan
ID3 .
:CN2 .

:WordNet ,

,
, .


Princeton University .
:Hypernym X

Hypernym Y Y Xcolor is a hypernym of :


.red
X
:Hyponym

Hyponym Y X Yred is a hyponym of :


.color
:Stemming

Stemming
,
cats, catlike, catty ...etc :
stem cat
:Cross Validation

K-Fold
.

.1:

.
Google 4.2 .
.

],[2
] .[1 .
) ( ) .(Class
IF <attrib = value> AND AND < attrib = value> THEN <class>.
9

( : : . (

) (
. :
<IF <Salary = High> AND <Mort gate = No> THEN <Good Credit
) Heuristic (
.
, ] .[1],[2 ,
)
( .
,
,
] ,[3 .

:
) (C4.5,CN2 ,
. ] .[3],[4
, :
.
. )(
) (
.[Attributes [3

.
) ( .

.2 :
:
-1 ).(Content Mining
-2 ).(Usage Mining
-3 )[Structure Mining). [5
-1 : )
HTML (Email .
-2 [6] :
.
-3 :
) ( . .
* ,
.

.3 :

10

( : : . (

(1 )(
,

.
( ,
(2 )
.
, HTML ].[7
> <meta:
><meta NAME=keywords
:
><meta NAME=description
. ,
) (
.
:Word Net ] .[8
.
Word Net ,:
: Word Net ) Stems
borrowed, borrowing, borrow
( . :
, borrow .
.
, Attribute .Pattern
: Word Net .

. .

: Word Net
.
. :
) , ,( ) , ,(
Word Net Tree Root )( .
6 ,
. Word Net
. Hypernym\Hyponym )is
(a ,Word Net .
(numberof edgesin the shortestrelationship
IF
IF NULL

) (1 .
) (JWNL Java World Net Language
Hypernyms Hypernym , Pseudo-
Code ) .(1
" Hypernym" .

11

( : : . (


.Hypernym
" ".
Hypernym

.

.4 :Ant-Miner
.

,
) Terms(.
) .(2
].[3
)
( . . Until
Loop.
.

, Terms
) (
.
) (2 .
Repeat Loop ,
:
* :
. ij

> - <Attribute i = Value j
ij (Tij(t
Tij(t)Nij Nij
ij ) t ( .T Nij
ij ] [1 .
Nij ij .
(Tij(t . Tij
,
)( )""( ) .
( ] [3
.
* :
,

.
* :
. ,
12

( : : . (


.
) ( :
.


.

,

. ,
.
:
.
.DiscoveredRuleList

.5 :

1.5 :Experimental Setup


127 ) , ,(
.BBC ,

) (Tags .
,
) (Meta Fields )( .
BBC
.
.
, ) Binary(

.


WordNet
.

:
.1 ).(Stemming
.
.2
WordNet
.
.3 Hypernym
) WordNet ).((1
.
Stop Words . :
:
" , ," .the, and ,they
Five-Fold Cross-
.[Validation [1

-.
13

( : : . (

] [3
):(d
)) No_of_Ants (a , : ( =
.3000
)) Min_cases_per_rule (b ( =
.10
) Max_uncovered_cases ( =
)(c
.10
) ) No_rules_converge (d
( = . 20 ) 10
( 20 .
2.5 :

. 1 2 )
(
WN-Generalization
" ."
WordNet hypernym. Title
Description ,
Union ) +(.
) :(1 BBC .

Setup
,WN-generalization
,WN-generalization
,WN-generalization
,Stemming
,Stemming
,Stemming

41
125
188
46
159
293

2.27 77.34
2.37 68.01
5.27 70.42
5.92 69.09
1.71 71.00
2.86 74.79

) (1 Setup
( .Attributes
)
:
,
.1
)(

. WN-generalization
Stemming
.
WordNet
.2
Stemming .
WordNet )
WordNet
%77.34 ( .
Stemming
.
) :(2 BBC .
14

( : : . (

Setup
,WN-generalization
,WN-generalization
,WN-generalization
,Stemming
,Stemming
,Stemming

47
163
226
52
188
339

2.93 81.00
2.90 68.69
2.62 67.81
6.04 71.28
4.90 74.29
4.04 70.97

) (2 )
( . :
,
.1
.
) (1) (2
WordNet -Stemming .

, )
( .
WordNet
.2
:
.Stemming ) (1) (2
WordNet

) WordNet %81.0
(.
WordNet

Stemming .
WordNet

) (1) (2

.
, WordNet
.Stemming
,
WordNet .
3.5 :C5.0
) (2
) (1 4 6 .
C5.0
) Clementine ( .
) (3 C5.0 .

.) (3

) ( .
.C5.0
) (3 ,
C5.0
15

( : : . (

. 4 6 ,
) ( .
.
,
.
C5.0

.

C5.0
.
) :(3 C5.0 BBC .

Setup
,WN-generalization

,WN-generalization

,WN-generalization

,Stemming

,Stemming

,Stemming

2.93 81.00

0.00 3.0

1.91 9.40

C5.0

4.77 73.19

1.44 12.00

1.71 24.80

2.90 68.69

0.00 3.0

2.58 12.40

C5.0

1.43 67.78

0.50 12.40

1.46 27.20

2.62 67.81

0.00 3.0

2.40 11.60

C5.0

2.08 71.83

0.40 11.60

0.87 23.40

6.04 71.28

0.00 3.0

1.70 12.13

C5.0

4.48 77.08

0.54 14.00

0.74 26.4

4.90 74.29

0.00 3.0

2.56 11.66

C5.0

4.41 71.03

0.54 11.00

1.79 22.25

4.04 70.97

0.00 3.0

2.16 10.06

C5.0

1.01 76.39

1.01 13.80

1.63 27.60

429 Yahoo
: , . ).(4
,
C5.0 .
.

C5.0 .
) :(4 C5.0 Yahoo
.
Setup

,WN-generalization

2.16 88.00

0.24 3.6

2.32 12.83

C5.0

1.88 89.87

1.20 18.6

6.80 42.20

,WN-generalization

1.99 86.50

0.00 3.0

2.93 14.53

16

( : : . (

,WN-generalization

,Stemming

,Stemming

,Stemming

C5.0

1.25 86.48

1.01 15.80

2.54 34.60

1.96 88.15

0.00 3.0

2.62 13.53

C5.0

1.24 86.46

0.74 16.60

2.41 39.80

2.52 83.54

0.24 3.4

2.48 12.88

C5.0

1.10 86.70

0.66 16.8

1.80 30.40

1.75 87.91

0.24 3.4

2.19 11.05

C5.0

3.63 83.14

1.07 17.4

1.22 29.00

2.62 90.01

0.00 3.0

2.33 12.00

C5.0

2.09 89.29

0.19 11.2

0.87 21.40

.6:

,
.
, ] [6] .[11
Clustering
].[2
* :
:
:

.1
.C5.0
,C5.0
.2
.
C4.5
CN2 ,
].[4] ,[3
:

- .
.WordNet WordNet
Hypernym .

.
WordNet
.
Stemming
- .

17

( . : : (

:
1.
Nicolas Holden and Alex A. Freitas. Web Page Classification with an
Ant Colony Algorithm, Computing Laboratory, University of Kent 2005.
2.
I.H. Witten and E. Frank. Data Mining: Practical Machine Learning
Tools with Java Implementations, Morgan Kaufmann Publications, 2000.
3.
U.M. Fayyad, G. Piatetsky-Shapiro and P. Smyth. From data mining to
knowledge discovery: an overview. In: U.M. Fayyad et al (Eds.) Advances in
Knowledge Discovery and Data Mining, 1-34. AAAI/MIT, 1996.
4.
R.S. Parpinelli, H.S. Lopes and A.A. Freitas. Data Mining with an Ant
Colony Optimization Algorithm. IEEE Trans. on Evolutionary Computation,
special issue on Ant Colony algorithms, 6(4), pp. 321-332, Aug. 2002.
5.
R.S. Parpinelli, H.S. Lopes and A.A. Freitas. An Ant Colony Algorithm
for Classification Rule Discovery. In: H.A. Abbass, R.A. Sarker, C.S. Newton.
(Eds.) Data Mining: a Heuristic Approach, pp. 191-208. London: Idea Group
Publishing, 2002.
6.
S. Chakrabarti Mining the web: discovering knowledge from hypertext
data. Morgan Kaufmann, 2003.
7.
A. Abraham and V. Ramos. Web Usage Mining Using Artificial Ant
Colony Clustering and Genetic Programming. Proc. Congress on Evolut. Comp.
(CEC-2003). IEEE Press, 2003.
8.
M. Cutler, H. Deng, S. S. Maniccam and W. Meng, A New Study Using
HTML Structures to Improve Retrieval. Proc. 11th IEEE Int. Conf. on Tools
with AI, 406-409. IEEE, 1999.
9.
C. Fellbaum (Ed.) WordNet - an electronic lexical database. MIT, 1998.
10. E. Bonabeau, M. Dorigo and G. Theraulaz. Swarm Intelligence: from
natural to artificial systems. Oxford, 1999.
11. M. Dorigo and L.M. Gambardella, Ant colonies for the traveling
salesman problem. Biosystems 43, 73-81. 1997.
12. K.M. Hoe, W.K. Lai, T.S.Y. Tai. Homogeneous ants for web document
similarity modeling and categorization. Ant algorithms, LNCS 2463, 256-261.
Springer, 2002.
13. R. Schoonderwoerd, O. Holland, J. Bruten, Ant-like agents for load
balancing in telecommunications networks. HP Labs Technical Report, HPL-9676, May 21, 1996.
),
.14

.2010 , (
www.alhasebat.net, . ,
.15
.2006
18

( : : . (

, ) ( .
.16
.www.arabteam2000.com, 2009

:
.1
.2

19

.www.wikipedia.com
.www.googlescholar.com

You might also like