aco

36
12.11.2003 Ant Colony Optimization 1 Ameisenalgorithmen – Ant Colony Optimization Lehrprobe zur Habilation, Barbara Hammer, AG LNM, Universität Osnabrück

Upload: john-chandler

Post on 11-May-2015

1.248 views

Category:

Education


5 download

TRANSCRIPT

Page 1: Aco

12.11.2003 Ant Colony Optimization 1

Ameisenalgorithmen –Ant Colony Optimization

Lehrprobe zur Habilation,Barbara Hammer,

AG LNM, Universität Osnabrück

Page 2: Aco

12.11.2003 Ant Colony Optimization 2

Optimization

Given a graph with two specified vertices A and B, find a shortest path from A to B.

Given a set of cities and pairwise distances, find a shortest tour.

Given a sequence of amino acids of a protein, find the structure of the protein.

‘Where is my manuscript for the talk, I put it on this pile of papers...’

General optimization problem:

given f:X ,ℝfind xεX such that f(x) is minimum

needle in a haystack, hopeless

traveling salesperson problem, NP-hard

shortest path problem, polynomial

protein structure prediction problem, NP-hard

Page 3: Aco

12.11.2003 Ant Colony Optimization 3

Ant colonyfood

nest

Page 4: Aco

12.11.2003 Ant Colony Optimization 4

Ant Colony Optimization (ACO):

a heuristic optimization method for shortest path and other optimization problems which borrows ideas from biological ants

Page 5: Aco

12.11.2003 Ant Colony Optimization 5

Ant Colony Optimization

Outline

History: ACO for shortest paths Traveling salesperson and ACO-metaheuristic Protein folding - state of the art ACO General comments - where is my manuscript?

Page 6: Aco

12.11.2003 Ant Colony Optimization 6

History: ACO for shortest paths …

Page 7: Aco

12.11.2003 Ant Colony Optimization 7

History: ACO for shortest paths

Goss et al. 1989, Deneuborg et al. 1990

experiments with Argentine ants: ants go from the nest to the food source and

backwards after a while, the ants prefer the shortest path

from the nest to the food source stigmercy:

the ants communicate indirectly laying pheromone trails and following trails with higher pheromone

length gradient pheromone will accumulate on the shortest path

Dorigo et al. 1991

applications to shortest path problems nest

food

Page 8: Aco

12.11.2003 Ant Colony Optimization 8

History: ACO for shortest paths I:directed

A first ACO for a simple shortest path problem:

directed acyclic graph (V={0,...,N}, E={ij}), ant hill: 0, food source: N

for all i: pi:=0; /*ant position init*/

si:=hungry; /*ant state init*/

for all i j: τij:=const; /*pheromone init*/

repeat for all i: ant_step(i); /*ant step*/

for all i j: τij := (1-ρ) τij ; /*evaporate pheromone*/

Page 9: Aco

12.11.2003 Ant Colony Optimization 9

History: ACO for shortest paths I:directed

ant_step(i):

if pi=N: si:=satisfied; if pi=0: si:=hungry; /*collect food/deliver food*/

if si=hungry: choose j with pij with probability τpi j/Σpij’τpij’ /*choose next step*/

update Δτpi j := ε; pi:=j; /*update pheromone*/

if si=satisfied: choose j with jpi with probability τjpi/Σj’piτj’pi

update Δτjpi:= ε; pi:=j; /* reversed directions*/

Page 10: Aco

12.11.2003 Ant Colony Optimization 10

History: ACO for shortest paths II:general

...a more complex undirected cyclic graph ...

WC4 WC5 Barbara Marc

449a Anja Dagmar Espresso

322 339 WC3 Friedhelm

Fachschaft WC2 Rechner Astrid

Zeitschriften WC Bibo RZ-Sekretariat

ToilettenCafete RZGetraenke-automat

Mensa

Page 11: Aco

12.11.2003 Ant Colony Optimization 11

History: ACO for shortest paths II:general

449a

449a

... Marc was not so happy with the result ...

Page 12: Aco

12.11.2003 Ant Colony Optimization 12

History: ACO for shortest paths II:general

for all i: pi:=0; /*ant position init*/

si:=( ); /*ant brain is empty*/

for all i-j: τi-j:=const; /*pheromone init*/

repeat for all i: construct_solution(i);

for all i: global_pheromone_update(i);

for all i-j: τi-j := (1-ρ) τi-j; /*evaporate*/

construct_solution(i):

while pi≠N /*no solution*/

choose j with pi-j with probability τpi-j / Σpi-j’τpi-j’;

pi:=j;

append j to si; /*remember the trail*/

global_pheromone_update(i):

for all j-j’ in si: Δτj-j’:= 1/length of the path stored in si;

minibrain

update according

to the quality

minibrain

si:=hungry

repeat for all i: ant_step(i);

Page 13: Aco

12.11.2003 Ant Colony Optimization 13

History: ACO for shortest paths II:general

WC4 WC5 Barbara Marc

449a Anja Dagmar Espresso

322 339 WC3 Friedhelm

Fachschaft WC2 Rechner Astrid

Zeitschriften WC Bibo RZ-Sekretariat

ToilettenCafete RZGetraenkeMensa

Page 14: Aco

12.11.2003 Ant Colony Optimization 14

History: ACO for shortest paths

init pheromone ti-j ;

repeat for all ants i: construct_solution(i);

for all ants i: global_pheromone_update(i);

for all edges: evaporate pheromone;

construct_solution(i):

init ant;

while not yet a solution:

expand the solution by one edge probabilistically according to the pheromone;

global_pheromone_update(i):

for all edges in the solution:

increase the pheromone according to the quality;

Page 15: Aco

12.11.2003 Ant Colony Optimization 15

Traveling salesperson and ACO-metaheuristic …

Page 16: Aco

12.11.2003 Ant Colony Optimization 16

Traveling salesperson

Traveling salesperson problem (TSP):

given n cities {1,...,N} and distances dij ≥0 between the cities,

find a tour with shortest length, i.e. a permutation π:{1,…,N}{1,…,N} such that the length = Σidπ(i)π((i+1)mod N) is minimum

classical NP-hard benchmark problem

A simple greedy heuristic:

start somewhere and always add the closest not yet visited city to the tour

Page 17: Aco

12.11.2003 Ant Colony Optimization 17

Traveling salesperson

init pheromone;

repeat for all ants i: construct_solution(i);

for all ants i: global_pheromone_update(i);

for all edges: evaporate pheromone;

construct_solution(i): init ant;

while not yet a solution

expand the solution by one edge probabilistically according to the pheromone;

global_pheromone_update(i):

for all edge in the solution:

increase the pheromone according to the quality;

A

B

C

D

key observation:

a tour (ACDBA)

decomposes into edges

AC, CD, DB

pheromone on the edges

Page 18: Aco

12.11.2003 Ant Colony Optimization 18

Traveling salesperson

init: set τij:=const for all cities i≠j;

repeat for all ants i: construct_solution(i);

for all ants i: global_pheromone_update(i);

for all edges i-j: evaporate pheromone;

Page 19: Aco

12.11.2003 Ant Colony Optimization 19

Traveling salesperson

global_pheromone_update(i);

for all jk in the solution:

Δτjk := const / length of the constructed tour

short tours yield to most pheromone

construct_solution(i): set ant to a randomly chosen city;

while not yet a solution:

j=current city,

expand by jk with probability =

only valid tours are constructed

close cities are preferred

α, β >0 control the mixture

of the greedy heuristic

and the pheromone following

otherwised

dcontainedalreadyk

visitednotk jkjk

jkjk

' ''

0

Page 20: Aco

12.11.2003 Ant Colony Optimization 20

Traveling salesperson

Results for a 30 cities instance (10 runs, one hour)

Results for larger instances (25000 constructed tours, best tour documented)

best average std.deviation

ACO 420 420.4 1.3

Tabu-search 420 420.6 1.5

Sim. Annealing 422 459.8 25.1

ACO Gen.Alg. Evol.Prog. Sim.Ann.

50 cities 425 428 426 443

75 cities 535 545 542 580

100 cities 21282 21761

Page 21: Aco

12.11.2003 Ant Colony Optimization 21

ACO-metaheuristic

Optimization problem for ACO: over a set of basic components C = {c1,...,cn} partial solutions are subsets s in C feasible (partial) solutions F in C solutions S in C cost function f for solutions

Goal: iteratively expand feasible partial solutions by components

to reach a solution s with minimum f(s), pheromone attached to each component ci guides the

search

edges ij

partial tours

tours which visit each city at most once and in consecutive order

length of the tour

valid tours

Page 22: Aco

12.11.2003 Ant Colony Optimization 22

ACO-metaheuristic

init pheromone τi=const for each component ci;

repeat for all ants i: construct_solution(i);

for all ants i: global_pheromone_update(i);

for all pheromones i: evaporate: τi=(1-ρ)∙τi;

construct_solution(i); init s={ };

while s is not a solution:

choose cj with probability =

expand s by cj;

global_pheromone_update(i);

for all cj in the solution s:

increase pheromone: τj=τj+ const / f(s);

otherwise

feasiblenotisj

feasiblej jj

jj

' ''

0

η is a heuristic value,

α,β balance the

heuristic/pheromone

general ACO algorithm

Page 23: Aco

12.11.2003 Ant Colony Optimization 23

Protein folding - state of the art ACO …

Page 24: Aco

12.11.2003 Ant Colony Optimization 24

Protein folding

Protein folding

given a sequence of amino acids s1…sn

where si in {1,0}, i.e. hydrophobic/polar

determine the structure of the protein

i.e. coordinates in a 2D rectangular lattice, such that

- neighbored sequence entries are at neighbored positions

- each position is occupied at most once

- the number of 1-1 contacts in the 2D structure is maximized

in the 2D-HP-model (Dill)

Page 25: Aco

12.11.2003 Ant Colony Optimization 25

Protein folding

9 additional 1-1 contacts

Dill, 1985: the HP model preserves important information of the biological conformation

Crescenzi et al. and Berger/Leighton, 1998: the problem is NP hard

Shmygelska/Hoss, 2003: ACO

Page 26: Aco

12.11.2003 Ant Colony Optimization 26

Protein folding

start at the left end and iteratively fold one amino acid into a relative direction

R,S,R,R,L,L,R,S,R,R,L,R,L,L,R,R,S,R in {R,S,L} length-2

basic components: an element in {i-R,i-S,i-L} represents the local structural motif at position (i-1,i,i+1) pheromone values τi-D , i = 2.. length-1, D = L,S,R

RS

R

...

R

L

S

Page 27: Aco

12.11.2003 Ant Colony Optimization 27

Protein folding

init pheromone τi-D=const for each tuple i-D;

repeat for all ants i: construct_solution(i);

for the best ants i: optimize_solution(i);

for the best ants i: global_pheromone_update(i);

for all pheromones i-D: evaporate: τi-D=(1-ρ)∙τi-D;

components: local structural motifs i-D

partial solutions: subsets of local structural motifs

feasible partial solutions: sequences of consecutive structural motifs without overlap of the amino acids in the 2D lattice

solutions: final folds

cost function to be maximized: number of 1-1 contacts in the 2D lattice

daemon action:

local

optimization

elitism

Page 28: Aco

12.11.2003 Ant Colony Optimization 28

Protein folding

construct_solution(i);

init s = { };

while s is not a solution: position j

choose a local structural motif j-D with probability proportional to

- 0 if the position is already occupied or the sequence gets trapped

- proportional to τj-Dα∙ηj-D

β

expand s by the chosen motif;

η is related to the

number of 1-1 contacts

of this motif

feasibility

optimize_solution(i);

perform a fixed number of feasible and improving substitutions of local structural motifs at random

global_pheromone_update(i);

for all local structural motifs in a solution:

τj-D := τj-D + number of 1-1 contacts in the solution / const;

Page 29: Aco

12.11.2003 Ant Colony Optimization 29

Protein folding

Best reported results for different size instances

length GA EMC MSOE PERM ACO

20 9 9 9 9

24 9 9 9 9

25 8 8 8 8

36 14 14 14 14

48 23 23 23 23

50 21 21 21 21

60 34 35 36 36

64 37 39 42 38 42

85 52 53 51

100 50 50 47

100 47 48 47

GA: genetic algorithm

EMC: evolutionary algorithm

+ Monte Carlo methods

MSOE: Monte Carlo including

overlapping conformations

PERM: iterated heuristic growing

method

Page 30: Aco

12.11.2003 Ant Colony Optimization 30

General comments - where is my manuscript …

Page 31: Aco

12.11.2003 Ant Colony Optimization 31

General comments

ACOs: nice, powerful, and robust metaheuristic for NP hard, possibly non -static optimization problems, the solutions of which decompose into single components

Applications for (* = state of the art results for some settings): quadratic assignment problems * vehicle routing * sequential ordering * shortest common supersequence * scheduling * graph coloring and partitioning telecommunication networks and routing * ...

more info on ACOs: Swarm Intelligence, From Natural to Artificial Systems, E.Bonabeau,

M.Dorigo, G.Theraulaz, Santa Fe, 1999 http://iridia.ulb.ac.be/~mdorigo/ACO/ Duft der Daten, Der Spiegel, November 13, 2000 Swarm smarts, Scientific American, March 2000

Page 32: Aco

12.11.2003 Ant Colony Optimization 32

General comments

Are ACO’s better than other metaheuristics for general optimization problems?

No free lunch theorem (Macready/Wolpert)

In the mean, no optimization algorithm is to be preferred!

Precise: Assume A and B are finite, B is totally ordered, F is a set of functions from A to B which is closed under permutation, H is a (randomized) search heuristic. Then the expected time to reach the first optimum is independent of H.

... so it might take a while until the ants find my manuscript, but they’ll find it.

Page 33: Aco

12.11.2003 Ant Colony Optimization 33

Jawoll!Rettet die Bildung!Gegen Stellenkürzungen

im Hochschulbereich!

Page 34: Aco

12.11.2003 Ant Colony Optimization 34

Page 35: Aco

12.11.2003 Ant Colony Optimization 35

ACO-metaheuristic

ACO-metaheuristic applicable to general optimization problems as stated above robust and tolerant to changes, e.g. in non-static problems yields state of the art solvers for some problems

with modifications daemon actions: improve the found solutions using local search

(e.g. k-opt for TSP) elitism: update pheromone only for the (local or global) best ants ...

Page 36: Aco

12.11.2003 Ant Colony Optimization 36

Protein folding – state of the art ACO

optimize_solution(i);

perform a fixed number of feasible and improving search moves randomly chosen from the following possibilities

- substitution of a single motif: substitute one motif i-D by a different one i-D’

- substitution of a sequence of motifs: substitute all motifs within randomly chosen positions by different motifs

- long-range moves: substitute one local motif and refold the two ends to feasible settings, whereby the respective original motifs are preserved if possible

LRSSRLS

LRSLRLSLRSSRLS

LSRLRLS

LRSSRLS

LRSLRLS

SLSLRLR