1 / 24

TSP with GAs

TSP with GAs. an example of problem analysis and optimization. TSP - by the categories. representation many choices fitness easy variation many choices selection initialization augmented algorithms. Representations. TSP is a permutation problem sequential (path) adjacent

glenna
Download Presentation

TSP with GAs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TSP with GAs an example of problem analysis and optimization

  2. TSP - by the categories • representation many choices • fitness easy • variation many choices • selection • initialization • augmented algorithms

  3. Representations • TSP is a permutation problem • sequential (path) • adjacent • ordinal • boolean adjacency matrix • boolean precedence matrix

  4. 3 4 6 1 1 2 3 4 5 6 3 5 4 6 1 2 5 2 Representations sequential (path) 3 - 4 - 6 - 2 - 5 - 1 adjacency ordinal 3,3,4,2,2,1 {1,2,3,4,5,6} {1,2,4,5,6} {1,2,5,6} {1,2,5} {1,5} {1}

  5. 3 4 6 1 5 2 Representations adjacency matrix precedence matrix

  6. 3 1 4 2 6 3 1 6 5 5 2 4 Crossover Variations based onsequential (path) representation PMX (partially-mapped crossover) • 3 - 4 - 6 - 2 - 5 - 1 • 1 - 2 - 3 - 4 - 5 - 6 swap segments • x - x - 3 - 4 - 5 - x • x - x - 6 - 2 - 5 - x retain where possible • x - x - 3 - 4 - 5 - 1 • 1- x - 6 - 2 - 5 - x map from swap • 6 - 2 - 3 - 4 - 5 - 1 • 1 - 4 - 6 - 2 - 5 - 3 analysis: what is inherited? parent 1 2 position? y y/n relative order? y y/n adjacency? y n

  7. 3 1 4 2 6 3 1 6 5 5 2 4 Crossover Variations based onsequential (path) representation OX (order crossover) CX (cycle crossover) using complementary representations Grefenstette’s heuristic (p.202) ER (edge recombination) analysis: what is inherited? parent 1 2 position? ? ? relative order? ? ? adjacency? ? ?

  8. 3 1 4 2 6 3 1 6 5 5 2 4 Single parent variations onsequential (path) representation Inversion (like 2-opt) Insertion Displacement Reciprocal exchange analysis: what is inherited?from parentposition ? relative order? ? adjacency? ?

  9. 3 1 4 2 6 3 1 6 5 5 2 4 Multi-parent variations onsequential (path) representation • Herdy’s heuristic (p.201) analysis: what is inherited?from parentsposition ? relative order? ? adjacency? ?

  10. 1 2 3 4 5 6 1 2 3 4 5 6 3 5 4 6 1 2 2 3 4 5 6 1 1 3 2 4 1 2 3 4 5 6 3 6 1 6 3 5 5 2 4 1 2 3 4 5 6 3 1 4 5 6 2 Crossover Variations based onadjacency representation Alternating edges edge from random parent repeat, random city if cycle 1 - 3 - 4 - 5 - 6 - 2 analysis: what is inherited? parent 1 2 position? ? ? relative order? ? ? adjacency? ? ?

  11. 3 1 4 2 6 3 1 6 5 5 2 4 Variations based onordinal representation • classic crossover works without repair . . . but how good is it? analysis: what is inherited? parent 1 2 position? ? ? relative order? ? ? adjacency? ? ?

  12. 3 4 1 2 3 4 5 6 1 6 0 0 0 0 0 0 1 2 1 0 0 0 1 0 5 2 3 1 1 0 1 1 1 4 1 1 0 0 1 1 5 1 0 0 0 0 0 1 1 0 0 1 0 6 Representations precedence matrix vij = 1 if i before j, i≠j

  13. 3 1 4 2 1 1 2 2 3 3 4 4 5 5 6 6 1 1 6 3 0 0 0 1 0 1 1 0 1 0 1 0 6 1 2 2 1 0 0 0 1 0 0 1 1 1 0 1 5 5 4 2 1 0 0 1 0 0 1 1 1 1 1 1 3 3 0 1 1 0 0 0 0 0 1 1 1 1 4 4 1 0 0 0 0 0 0 0 0 0 1 0 5 5 0 1 1 0 0 0 0 0 0 1 0 0 6 6 Variations based onprecedence matrix representation • intersection • union analysis: what is inherited? parent 1 2 position? ? ? relative order? ? ? adjacency? ? ?

  14. 3 4 1 2 3 4 5 6 1 6 0 0 1 0 0 0 1 2 0 0 0 0 1 0 5 2 3 0 0 0 1 0 0 4 0 0 0 0 0 1 5 1 0 0 0 0 0 0 1 0 0 0 0 6 Representations (directed) adjacency matrix vij = 1 if ij is directed edge

  15. 1 2 3 4 5 6 1 0 1 0 0 0 0 2 0 0 1 0 0 0 3 1 2 4 0 0 0 1 0 0 3 1 2 3 4 5 6 0 0 0 0 1 0 4 1 3 6 0 0 1 0 0 0 6 1 0 0 0 0 0 1 5 2 0 0 0 0 1 0 1 0 0 0 0 0 6 5 5 2 4 0 0 0 1 0 0 3 0 0 0 0 0 1 4 1 0 0 0 0 0 5 0 1 0 0 0 0 6 Variations based onadjacency matrix representation • submatrix rearrangement • common links analysis: what is inherited? parent 1 2 position? ? ? relative order? ? ? adjacency? ? ?

  16. Selection strategies • Incest-prevention - solutions can’t cross over with close relatives • goal: maintain variety in population • LIKE TABU

  17. Extending EA’s with local search procedure evolutionary algorithm**(p.215) t <-- 0 initialize P(t) // population local-optimize(P(t)) while (~termination-condition) do t <-- t+1 P’(t) <-- alter(P(t-1)) // offspring local-optimize(P’(t)) P(t) <-- select (P’(t), P(t-1)) end end (I have revised this algorithm)

  18. procedure evolutionary algorithm**(p.215) t <-- 0 initialize P(t) // population local-optimize(P(t)) while (~termination-condition) do t <-- t+1 P’(t) <-- alter(P(t-1)) // offspring local-optimize(P’(t)) P(t) <-- select (P’(t), P(t-1)) end end interpretation • populations are locally optimized • alterations produce ‘infeasible’ (not locally optimal) solutions that are repaired by local optimization • example: Muhlenbein, p.215 • OX (order crossover) and 2-opt local optimization

  19. Edge assembly crossover (EAX) Extended EA algorithm • expensive crossover with local optimization heuristic (variation) • repeatedly used with same parents looking for a child better than both (locally optimized selection)

  20. Edge assembly crossover (EAX) Extended EA algorithm local optimization • expensive crossover with local optimization heuristic (variation) 3 4 4 4 6 1 6 6 5 2 5 5 3 4 3 3 6 1 1 1 2 2 5 2

  21. 3 4 4 4 4 4 4 4 6 1 6 6 6 6 6 6 5 2 5 5 5 5 3 4 5 5 3 3 3 3 6 3 3 1 1 1 1 1 2 2 2 2 5 2 1 1 2 2 Edge assembly crossover (EAX) Extended EA algorithm (p.217) • repeatedly used with same parents looking for a child better than both (locally optimized selection) local optimization

  22. The champion TSP algorithm:Inver-over operator procedure inver-over initialize P while not done for each Si P S’ <-- inver-over-op(Si) if (eval(S’) ≤ eval(Si)) Si <-- S’

  23. Inver-over operatorAsymmetric multi-parent operator inver-over-op(Si) S’ <-- Si c <-- random city from S’ repeat if (rand() < p) select c’ from S’, c’≠c else select Sj, Sj ≠ Si c’ <-- city next to c in S’ do 2-opt swap between c, c’ in S’ c <-- c’ until c’ follows c in Si return S’

  24. Inver-over inver-over-op(Si) S’ <-- Si c <-- random city from S’ repeat if (rand() < p) select c’ from S’, c’≠c else select Sj, Sj ≠ Si c’ <-- city next to c in S’ do 2-opt between c, c’ in S’ c <-- c’ until c’ follows c in Si return S’ S’: 3-7-2-5-1-6-4 c <-- 2 p? c’<--6S’ c’<--1 Sj: 7-4-6-2-1-5-3 S’:3-7-2-6-1-5-4 S’: 3-7-2-1-5-6-4 c <--6 c <--1 2 new edges 1 inherited edge 1 new edge

More Related