25
Fan Yang 6.338 Final Project Professor Edelman

Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Fan Yang 6.338 Final Project

Professor Edelman

Page 2: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Outline 2

I.  Introduction A.  The Traveling Salesman Problem B.  Simulated Annealing C.  Genetic Algorithm

II.  Methods III.  Results

A.  Running Time B.  Parallel Speedup C.  Optimization D.  Rate of Convergence

IV.  Conclusion

Page 3: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

3

Page 4: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Find the shortest route that goes through a set of nodes (cities).

Traveling Salesman Problem 4

Figure 1: An example of the traveling salesman problem.

Page 5: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Simulated Annealing

1.  Start with a state with some initial energy 2.  Reduce the energy at each iteration via state

transitions (neighbor functions & acceptance function)

3.  Terminate after some iteration count or low energy threshold achieved

5

Page 6: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Serial Simulated Annealing Algorithm

  Initialization: Generate a random candidate route and calculate energy for the route.

  Repeat following steps:   Neighbor function: Generate a neighbor route by

exchanging a pair of cities.   Acceptance function: Evaluate the neighbor route for

acceptance - if accepted, replace current route with neighbor route

6

Page 7: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Parallel Simulated Annealing Algorithm

1.  On each thread:   Initialization: Generate a random candidate route

and calculate energy for the route.   Repeat following steps:

if ITERATION_COUNT != CONVERGING_COUNT   Neighbor function: Generate a neighbor route by exchanging a pair of

cities.   Acceptance function: Evaluate the neighbor route for acceptance - if

accepted, replace current route with neighbor route Else

  MPI_BARRIER: share the best result among threads by sending all the results to root and have root broadcast the best result

2.  MPI_BARRIER: return the best result among all the threads

7

Page 8: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Genetic Algorithm

1.  Start with a population of routes 2.  At each iteration, replace the worst routes with the

children of the best routes 3.  Terminate after some iteration count

8

Page 9: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Serial Genetic Algorithm

  Initialization: Generate N random candidate routes and calculate fitness value for each route.

  Repeat following steps:   Selection: Select two best candidate routes.   Reproduction: Reproduce two routes from the best

routes.   Generate new population: Replace the two worst

routes with the new routes.

9

Page 10: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Parallel Genetic Algorithm

1.  On each thread:   Initialization: Generate N random candidate routes and

calculate fitness value for each route.   Repeat following steps: 

if ITERATION_COUNT != CONVERGING_COUNT   Selection: Select two best candidate routes.   Reproduction: Reproduce two routes from the best routes.   Generate new population: Replace the two worst routes with the

new routes. Else

  MPI_BARRIER: share the best result among threads by sending all the results to root and have root broadcast the best result

2.  MPI_BARRIER – return the best result among all the thread

10

Page 11: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

11

Page 12: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Methods

  C with MPI on Beowulf cluster (using 1 to 8 nodes)

  Genetic Algorithm:   Iterations: 100,000

  population count: 1000

  Simulated Annealing   Iterations: 1,000,000

  Start temperature: 10.0

  Cooling constant: 0.9999

  For each condition, we conducted a total of 10 trials.

  Distances were computed as Euclidean distances.

12

CITIES COORDINATES (X, Y)

a (110, 54)

b (236, 110)

c (153, 151)

d (227, 49)

e (307, 176)

f (220, 211)

g (341, 90)

h (149, 91)

i (335, 40)

j (371, 150)

k (218, 161)

l (334, 239)

m (148, 227)

n (49, 128)

o (183, 39)

Page 13: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

13

Page 14: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Running time results 14

Figure 2: Simulated annealing algorithm running time. The running time decreases as the number of processors increases.

Page 15: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Figure 3: Genetic algorithm running time. The running time decreases as the number of processors increases.

Running time results 15

Page 16: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Parallel speedup results 16

Figure 4: Simulated annealing algorithm parallel speedup. There is a near-linear parallel speedup. The curve approximates an ideal linear line at all points.

Page 17: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Parallel speedup results 17

Figure 5: Genetic algorithm parallel speedup. There is a near-linear parallel speedup. The scalability deteriorates slightly at 7-8 processors.

Page 18: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Optimization results 18

Figure 6: Simulated annealing algorithm distance results. The distance of the shortest route decreases as the number of processors increases. The anomaly at processor #5 is most likely due to an outlier in the raw data points, which is also indicated by the large standard deviation.

Page 19: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Optimization results 19

Figure 7: Genetic algorithm distance results. The distance of the shortest route decreases as the number of processors increases.

Page 20: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Figure 8: Simulated annealing algorithm convergence running time. There is a gradual increase in running time as the rate of convergence increases. The running time exceeds the serial implementation at a convergence rate of 35%.

Rate of convergence: running time results 20

Page 21: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Figure 9: Genetic algorithm convergence running time. There is a gradual increase in running time as the rate of convergence increases. The running time exceeds the serial implementation at a convergence rate of 15%.

Rate of convergence: running time results 21

Page 22: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Figure 10: Simulated annealing convergence distance results. The distance of the shortest route decreases as we increase the rate of convergence. The shortest distance plateaus beginning at a 10% rate of convergence.

Rate of convergence: optimization results 22

Page 23: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

Figure 11: Genetic algorithm convergence distance results. The distance of the shortest route decreases as we increase the convergence rate. The shortest distance plateaus beginning at a 5% rate of convergence.

Rate of convergence: optimization results 23

Page 24: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

  Good parallel speedup in both algorithms   Genetic algorithm achieves slightly better

results o  More mutations in each iteration is better

  Higher rate of convergence improves route optimization results but also increases the running time.

24

Page 25: Final Project Presentation · 6.338 Final Project Professor Edelman . Outline 2 I. Introduction A. The Traveling Salesman Problem B. Simulated Annealing C. Genetic Algorithm II. Methods

25