ACO ant colony

38
1 for an ant colony optimization algorithm For shortest paths on directed acyclic graphs Nattapat Attiratanasunthron Joint work with Jittat Fakcharoenphol Department of Computer Engineering Kasetsart University

description

อธิบายและวิเคราะห์ algorithm ของ ACO

Transcript of ACO ant colony

Page 1: ACO ant colony

1

A running time analysis for an ant colony

optimization algorithmFor shortest paths on

directed acyclic graphs

Nattapat Attiratanasunthron

Joint work with Jittat Fakcharoenphol

Department of Computer EngineeringKasetsart University

Page 2: ACO ant colony

2

ลำ��ดั�บก�รนำ��เสนำอ

• วั�ตถุ�ประสงค์�ของงานวั�จั�ย• ผลงานวั�จั�ยก่�อนหน�า• ผลงานวั�จั�ยของเรา• วั�เค์ราะห�เวัลาก่ารทำ�างาน• ผลก่ารทำดลอง

Page 3: ACO ant colony

3

วั�ตถุ�ประสงค์�ของง�นำวั�จั�ย

• วั�เค์ราะห�เวัลาในก่ารทำ�างานของ ACO algorithms ในก่ารแก่�ป!ญหา shortest path บน DAG– ซึ่%&งป!ญหา One-Max เป'นก่รณี)พิ�เศษของ

ป!ญหาน)-

Page 4: ACO ant colony

4

ACO algorithmNatural behavior of ant •ใช้�มดหลายต�วัในก่ารทำ�างาน

•ซึ่%&งมดแต�ละต�วัช้�วัยก่�นในก่ารแก่�ป!ญหา•และจัะต�ดต�อส0&อสารก่�นโดยฝาก่ Pheromone ไวั�บนเส�นทำาง•มดจัะทำ�าก่ารเล0อก่เส�นทำางทำ)&ส� -นก่วั�าโดยใช้�ค์วัามเข�มข�นของ Pheromone เป'นส�วันในก่ารต�ดส�นใจั• Pheromone บนเส�นทำางม)ก่ารปร�บเปล)&ยนค์�าตามเวัลาทำ)&เปล)&ยนแปลงไป โดยมาก่หร0อน�อยข%-นอย4�ก่�บอ�ตราก่ารระเหยของ Pheromone

Page 5: ACO ant colony

5

ผลำง�นำวั�จั�ยก�อนำหนำ��• Stutzle และ Dorigo แสดงวั�า ACO

algorithm Convergence–พิ�ส4จัน�วั�าถุ�าให�เวัลานานพิอ ACO algorithm

จัะพิบค์�าตอบทำ)&ด)ทำ)&ส�ด– ไม�สามารถุระบ�เวัลาในก่ารทำ�างานได�

• Neumann และ Witt วั�เค์ราะห�เวัลาก่ารทำ�างานของ 1-ANT algorithm บนป!ญหา One-Max

Page 6: ACO ant colony

6

นำ�ย�มป�ญห� one-max

• ป!ญหา one-max ค์0อม) set ของต�วัแปร x1,x2,…,xn ทำ)&แต�ละต�วัม)ค์�า {0,1}

• จั�ดประสงค์�ค์0อต�องก่ารผลรวัมของค์�า Xi ทำ)&มาก่ทำ)&ส�ด ;

)max(1

n

i ix

one-max [Neumann and Witt]

Page 7: ACO ant colony

7

ก�รมองป�ญห� one-max เป"นำก�รห�เส�นำท�งในำกร�ฟ

one-max [Neumann and Witt]

Page 8: ACO ant colony

8

Running time ของ 1-ant Algorithm บนป!ญหา one-max [Neumann and Witt] )(2 1)( 3/

nifn

เวัลำ�ก�รท��ง�นำ ของ 1-ANT

n/1Phase Transition บนอ�ตราก่ารระเหย

)()( 12 nifn

time

Page 9: ACO ant colony

9

ผลำง�นำวั�จั�ย• บทำวั�เค์ราะห�เวัลาในก่ารทำ�างานของ ACO

algorithms – one-max (มดหลายต�วั)

•เวัลาก่ารทำ�างานเป'น •ไม�ม) phase transition บนอ�ตราก่ารระเหย

– single-destination shortest path problem on directed acyclic graphs•เวัลาก่ารทำ�างานเป'น

)log(2

nn

)log(2

nmn

Page 10: ACO ant colony

10

One-Max (version multi graph)

• edge ทำ)& e(2n-1) ม)ค์�า weight เป'น X=1• edge ทำ)& e(2n) ม)ค์�า weight เป'น X=0

one-max (แบบ multiple graph) โดยม)ค์�ณีสมบ�ต�ด�งน)-

e(2n-1)

e(2n)

e1 e3 e5 e7 e9

e2 e4 e6 e8 e10

Vo V1 V2 V3 V4V5

Vn

Xi=1

Xi=0

Page 11: ACO ant colony

11

ขอบเขตของค์�� pheromone

• pheromone บนเส�นเช้0&อมใดๆ ม)ค์�าได�มาก่ทำ)&ส�ดม)ค์�าไม�เก่�น

• pheromone บนเส�นเช้0&อมใดๆ ม)ค์�าได�น�อยทำ)&ส�ดม)ค์�าไม�เก่�น

• ถุ�าค์�า pheromone บนเส�นเช้0&อม และบนเส�นเช้0&อม จัะเร)ยก่วั�า correctly saturated

max

max)12( ne

min)2( ne

min

Page 12: ACO ant colony

12

Multiple-Ant Algorithm for one-max

• Initial State– Initial pheromone value = 1/2– Initial Ant n-1 – –

• while forever do• for i=1 to n-1

• ant i random walks

• calculate distance

• update pheromone

• solution generated by ant 1

n/1min

Multiple-Ant Algorithm for One-Max

nn /)1(max

Page 13: ACO ant colony

13

PROCEDURE ANT_WALK

• ถุ�ามดอย4�ทำ)&โหนด i มดต�วัจัะทำ�าก่ารเล0อก่เส�นเช้0&อม e(2i-1) ด�วัยค์วัามน�าจัะเป'น

• น�&นค์0อ ถุ�า Z เป'นต�วัแปรส��มแบบสม�&าเสมอบน [0,1]then

ii

iZif

)2()12(

)12(

)12( ienodeselect

)2( ienodeselect

else

)2()12(

)12(

ii

i

Page 14: ACO ant colony

14

PROCEDUCE PHEROMENE_UPDATE

thenffif uu

iANTFORUPDATEPHEROMONEPROCEDURE

maxmax , ee thenif

conditionboundary//

ve

e

e

Seif

otherwise

,)1(

)1(

uuuu SSff

,

doEwueeachfor ),(

updatenormal//

minmin , ee thenif

Page 15: ACO ant colony

15

ต�วัอย�างก่ารทำ�างานของ multiple-ant algorithm

ก่�าหนดค์�าเร�&มต�น ให�มดแต�ละต�วัอย4�ในทำ�ก่ๆ โหนด และ pheromone ในทำ�ก่ๆ เส�นเช้0&อม

Page 16: ACO ant colony

16

ต�วัอย�างก่ารทำ�างานของ multiple-ant algorithm(2)

ต�วัอย�างทำ)& 1 : พิ�จัารณีา มดต�วัทำ)& i = 1 ในก่ารทำ�างานรอบทำ)& 1

มดต�วัทำ)& i = 1 เด�นได�ค์วัามยาวั เป'น 4 ; ระยะก่�อนหน�าเป'น 0

X1=1 X2=1 X4=0 X5=1 X6=0 X7=1X3=0

เพิราะฉะน�-น ทำ�าก่ารปร�บค์�า pheromone บนเส�นทำางทำ)& X1

Page 17: ACO ant colony

17

ต�วัอย�างก่ารทำ�างานของ multiple-ant algorithm(3)

ต�วัอย�างทำ)& 2 : พิ�จัารณีา มดต�วัทำ)& i = 5 ในก่ารทำ�างานรอบทำ)& 3

มดต�วัทำ)& i = 5 เด�นได�ค์วัามยาวั เป'น 2 ; ระยะก่�อนหน�าเป'น 3

X5=1 X6=0 X7=1

เพิราะฉะน�-น ไม�ม)ก่ารปร�บค์�า pheromone

Page 18: ACO ant colony

18

ต�วัอย�างก่ารทำ�างานของ multiple-ant algorithm(4)

ต�วัอย�างทำ)& 3 : พิ�จัารณีา มดต�วัทำ)& i = 5 ในก่ารทำ�างานรอบทำ)& 3

มดต�วัทำ)& i = 5 เด�นได�ค์วัามยาวั เป'น 3 ; ระยะก่�อนหน�าเป'น 3

X5=1 X6=1 X7=1

เพิราะฉะน�-น ทำ�าก่ารปร�บค์�า pheromone บนเส�นทำางทำ)& X5

Page 19: ACO ant colony

19

วั�เค์ร�ะห�เวัลำ�ในำก�รท��ง�นำของ ACO algorithms

• วั�เค์ราะห�เวัลาในก่ารทำ�างานของ ACO algorithms บนป!ญหา One-Max

Page 20: ACO ant colony

20

Running timeanalysis

Lemma 1:

Lemma 2: จั�านวันค์ร�-งของก่ารปร�บ ; เม0&อมดเด�นได�มาก่ก่วั�าหร0อเทำ�าก่�บค์�าก่�อนหน�า

Lemma 3: ค์วัามน�าจัะเป'นของมดต�วัทำ)& i ในก่ารทำ)&จัะเล0อก่เส�นทำางทำ)&ม)ค์�า Xi เทำ�าก่�บ 1

.maxmin )(, ttandiallFor i

solutionjiifijij ),(,maxmin )log

1( nT

T

ป!จัจั�ยของก่ารวั�เค์ราะห�เวัลาในก่ารทำ�างาน

. n)(1/

จัาก่

Page 21: ACO ant colony

21

บทพิ�ส'จันำ� : Lemma 1

minmin , ee thenif

thenffif uu

iANTFORUPDATEPHEROMONEPROCEDURE

maxmax , ee thenif

conditionboundary//

ve

e

e

Seif

otherwise

,)1(

)1(

uuuu SSff

,

doEwueeachfor ),(

updatenormal//

Page 22: ACO ant colony

22

บทพิ�ส'จันำ� : Lemma 1

minmin , ee thenif

iANTFORUPDATEPHEROMONEPROCEDURE

maxmax , ee thenif

conditionboundary//

.maxmin )(, ttandiallFor i

Page 23: ACO ant colony

23

บทพิ�ส'จันำ� : Lemma2

จั�านวันค์ร�-งในก่ารปร�บค์�า • ก่�าหนดให� pheromone บน และ• ด�งน�-นให� ก่�าหนดให� T =

max)2( nesolutionjiifijij ),(,maxmin

min)12( ne

maxmin τT

)log1

(ln1

min

maxn

minmax

max)1(min,

)1(

}max{

T

ijT

)/ln(/1max

)/ln(/1max

minmaxminmax)(1

e

min)/ln(

maxminmax e

Page 24: ACO ant colony

24

ทำ)&โหนดใดๆ ในก่ราฟ มดต�วัทำ)& i ม)ค์วัามน�าจัะเป'นทำ)&จัะเล0อก่เส�นทำางทำ)&ม)ค์�า Xi ทำ)&ม)ค์�าเป'น 1 เทำ�าก่�บ

บทพิ�ส'จันำ� : Lemma3

)1(2

1

/)1(2

/1

maxmax

min

'

nnn

n

jj

j

. n)(1/

. n)(1/

Page 25: ACO ant colony

25

Theorem 1

Theorem 1 : Running Time ของ Multiple-Ant Algorithm บนป!ญหา

one-max เป'น)log(

2

nn

Page 26: ACO ant colony

26

Lemma 2 : จั�านวันค์ร�-งของก่ารปร�บค์�า

Lemma 3 : ค์วัามน�าจัะเป'นในก่ารทำ)&มดเล0อก่เส�นทำาง Xi =1 เป'น

บทพิ�ส'จันำ� : Theorem 1

)log1

( nn

)(1

nn

พิ�จัารณีาก่ารทำ�างานของมดต�วัทำ)& n-1 ;

จัาก่ Lemma ทำ)& 2 และ 3nT log

1

Page 27: ACO ant colony

27

บทพิ�ส'จันำ� : Theorem 1 (2)

)log( nn

)/11(/1/)1(

/)1(

minmax

max nnnn

nn

constantพิ�จัารณีาก่ารทำ�างานของมดต�วัทำ)& n-2 ; เม0&อเวัลาผ�านไป

)log1

( nn

Page 28: ACO ant colony

28

บทพิ�ส'จันำ� : Theorem 1 (3)

)log2( nn

O

)log1

( nn

พิ�จัารณีาก่ารทำ�างานของมดต�วัทำ)& n-3 ; เม0&อเวัลาผ�านไป constantค์วัามน�าจัะเป'นของ

Xn-3 เป'น 1/n

Page 29: ACO ant colony

29

Correctly saturate

บทพิ�ส'จันำ� : Theorem 1 (5)

1

1

)/11(/1/)1(

/)1(1

minmax

max

i

i

nnnn

nni

)1()/11( 11 en n

เพิราะฉะน�-นหาก่ทำ�ก่ๆ เส�นเช้0&อมจัาก่โหนด i ม)ค์�า pheromone เป'น correctly saturated แล�วัน�-น ค์วัามน�าจัะเป'นในก่ารทำ)&มดจัะเล0อก่เส�นทำางถุ4ก่ต�องทำ�-งหมดจัาก่โหนดน�-นจัะเป'น

i

Page 30: ACO ant colony

30

Theorem 1 : Running Time ของ Multiple-Ant Algorithm บนป!ญหา

one-max เป'น

บทพิ�ส'จันำ� : Theorem 1 (4)

)log( nn

n

)log(2

nn

)log( nn

Page 31: ACO ant colony

31

Experiment on one-max

1n

ก่ารปร�บค์�าของ pheromones บนเส�นทำางทำ)& Xi ม)ค์�าเป'น 1 เม0&อเทำ)ยบก่�บเวัลา (multiple-ant algorithm ส�าหร�บ one-max โดยก่�าหนด n = 30 )

ก�รปร�บค์�� pheromone บนำเส�นำท�งท()ม(ค์�� Xi เป"นำ 1 (Multiple-ant)

Page 32: ACO ant colony

32

Experiment on one-max (2)ก�รปร�บค์�� pheromone บนำเส�นำท�งท()ม(ค์�� Xi เป"นำ 0

(Multiple-ant)

ก่ารปร�บค์�าของ pheromones บนเส�นทำางทำ)& Xi ม)ค์�าเป'น 0 เม0&อเทำ)ยบก่�บเวัลา (multiple-ant algorithm ส�าหร�บ one-max โดยก่�าหนด n = 30 )

Page 33: ACO ant colony

33

Experiment on one-max (3)

ก�รปร�บค์�� pheromone บนำเส�นำท�งท()ม(ค์�� Xi เป"นำ 1 (1-ant)

ก่ารปร�บค์�าของ pheromones บนเส�นทำางทำ)& Xi ม)ค์�าเป'น 1 เม0&อเทำ)ยบก่�บเวัลา (1-ant algorithm ส�าหร�บ one-max โดยก่�าหนด n = 30 )

Page 34: ACO ant colony

34

- ACO based Algorithm for Finding SingleDestination

Shortest Paths on a DAG Theorem 2 : Running Time ของ Multiple-Ant

Algorithm บน DAG เป'น

)log1

( 2 nmn

Page 35: ACO ant colony

35

Experiment on DAG

- ACO based Algorithm ส��หร�บก�รห� SingleDestination

Shortest Paths บนำ DAG

ต�วัอย�าง ก่ราฟ G เป'น DAG โดย n=16

Page 36: ACO ant colony

36

Experiment on DAG (2)

ก่ารปร�บค์�าของ pheromones เม0&อเทำ)ยบก่�บเวัลา (muliple-ant algorithm บน DAGโดยก่�าหนด n = 25 )

Page 37: ACO ant colony

37

Experiment on DAG (3)

ก่ารปร�บค์�าของ pheromones เม0&อเทำ)ยบก่�บเวัลา (muliple-ant algorithm บน DAGโดยก่�าหนด n = 25 )

Page 38: ACO ant colony

38

Thank you

Q/A