- 94 Views
- Uploaded on

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 - by the categories

- representation many choices
- fitness easy
- variation many choices
- selection
- initialization
- augmented algorithms

Representations

- TSP is a permutation problem
- sequential (path)
- adjacent
- ordinal
- boolean adjacency matrix
- boolean precedence matrix

4

6

1

1

2

3

4

5

6

3

5

4

6

1

2

5

2

Representationssequential (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}

1

4

2

6

3

1

6

5

5

2

4

Crossover Variations based onsequential (path) representationPMX (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

1

4

2

6

3

1

6

5

5

2

4

Crossover Variations based onsequential (path) representationOX (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? ? ?

1

4

2

6

3

1

6

5

5

2

4

Single parent variations onsequential (path) representationInversion (like 2-opt)

Insertion

Displacement

Reciprocal exchange

analysis: what is inherited?from parentposition ?

relative order? ?

adjacency? ?

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

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

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

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

Representationsprecedence matrix

vij = 1 if i before j, i≠j

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

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

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

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

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)

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

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

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

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 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-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’<--6S’ 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

Download Presentation

Connecting to Server..