9. History: ACO for shortest paths I:directed ant_step (i): if p i =N: s i :=satisfied; if p i =0: s i :=hungry; /*collect food/deliver food*/ if s i =hungry: choose j with p i j with probability τ pi j / Σ pi j’ τ pi j’ /*choose next step*/ update Δτ pi j := ε ; p i :=j; /*update pheromone*/ if s i =satisfied: choose j with j p i with probability τ j pi / Σ j’ pi τ j’ pi update Δτ j pi := ε ; p i :=j; /* reversed directions*/
10.
11. History: ACO for shortest paths II:general 449a 449a ... Marc was not so happy with the result ...
12. History: ACO for shortest paths II:general for all i: p i :=0; /*ant position init*/ s i :=( ); /*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 p i ≠N /*no solution*/ choose j with p i -j with probability τ pi-j / Σ pi-j’ τ pi-j’ ; p i :=j; append j to s i ; /*remember the trail*/ global_pheromone_update (i): for all j-j’ in s i : Δτ j-j’ := 1/length of the path stored in s i ; minibrain update according to the quality minibrain s i :=hungry repeat for all i: ant_step (i);
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 Toiletten Cafete RZ Getraenke Mensa
14. History: ACO for shortest paths init pheromone t i-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 ;
16. Traveling salesperson Traveling salesperson problem (TSP): given n cities {1,...,N} and distances d ij ≥0 between the cities, find a tour with shortest length, i.e. a permutation π :{1,…,N} {1,…,N} such that the length = Σ i d π (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
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 (A C D B A) decomposes into edges A C, C D, D B pheromone on the edges
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;
19. Traveling salesperson global_pheromone_update (i); for all j k 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 j k with probability = only valid tours are constructed close cities are preferred α , β >0 control the mixture of the greedy heuristic and the pheromone following
20.
21.
22. ACO-metaheuristic init pheromone τ i =const for each component c i ; 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 c j with probability = expand s by c j ; global_pheromone_update (i); for all c j in the solution s: increase pheromone: τ j = τ j + const / f(s); η is a heuristic value, α , β balance the heuristic/pheromone general ACO algorithm