Fan Yang 6.338 Final Project Professor Edelman
Fan Yang 6.338 Final Project Professor Edelman Outline 2 - - PowerPoint PPT Presentation
Fan Yang 6.338 Final Project Professor Edelman Outline 2 - - PowerPoint PPT Presentation
Fan Yang 6.338 Final Project Professor Edelman Outline 2 Introduction I. The Traveling Salesman Problem A. Simulated Annealing B. Genetic Algorithm C. II. Methods III. Results Running Time A. Parallel Speedup B. Optimization C. Rate of
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
3
Find the shortest route that goes through a set
- f nodes (cities).
Traveling Salesman Problem
4
Figure 1: An example of the traveling salesman problem.
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
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
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
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
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
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
11
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)
- (183, 39)
13
Running time results
14
Figure 2: Simulated annealing algorithm running time. The running time decreases as the number of processors increases.
Figure 3: Genetic algorithm running time. The running time decreases as the number of processors increases.
Running time results
15
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.
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.
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.
Optimization results
19
Figure 7: Genetic algorithm distance results. The distance of the shortest route decreases as the number of processors increases.
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
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
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
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
Good parallel speedup in both algorithms Genetic algorithm achieves slightly better
results
- More mutations in each iteration is better
Higher rate of convergence improves route
- ptimization results but also increases the