Tsp with gas
Download
1 / 24

TSP with GAs - PowerPoint PPT Presentation


  • 94 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' TSP with GAs' - glenna


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Tsp with gas

TSP with GAs

an example of

problem analysis

and optimization


Tsp by the categories
TSP - by the categories

  • representation many choices

  • fitness easy

  • variation many choices

  • selection

  • initialization

    • augmented algorithms


Representations
Representations

  • TSP is a permutation problem

    • sequential (path)

    • adjacent

    • ordinal

    • boolean adjacency matrix

    • boolean precedence matrix


Representations1

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}


Representations2

3

4

6

1

5

2

Representations

adjacency matrix

precedence matrix


Crossover variations based on sequential path representation

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


Crossover variations based on sequential path representation1

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? ? ?


Single parent variations on sequential path representation

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? ?


Multi parent variations on sequential path representation

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? ?


Crossover variations based on adjacency representation

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? ? ?


Variations based on ordinal representation

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? ? ?


Representations3

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


Variations based on precedence matrix representation

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? ? ?


Representations4

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


Variations based on adjacency matrix representation

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? ? ?


Selection strategies
Selection strategies

  • Incest-prevention - solutions can’t cross over with close relatives

    • goal: maintain variety in population

    • LIKE TABU


Extending ea s with local search
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)


Interpretation

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


Edge assembly crossover eax extended ea algorithm
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)


Edge assembly crossover eax extended ea algorithm1
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


Edge assembly crossover eax extended ea algorithm p 217

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


The champion tsp algorithm inver over operator
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’


Inver over operator asymmetric multi parent operator
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’


Inver over
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


ad