implementation report: concurrent genetic algorithm with
TRANSCRIPT
1/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Implementation Report:Concurrent Genetic Algorithm
with Island Migration
Markus Solbach
Laboratory for Active and Attentive VisionDepartment of Computer Science and Engineering
York University, Toronto, Ontario, Canada
November 10, 2015
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
2/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Overview
Genetic Algorithm revisited
Genetic Algorithm Operators
Concurrency
Some Results
Future Work Figure :Evolution ‖i.livescience.com (Oct. 5. 15)
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
3/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Genetic Algorithm revisited
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
4/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Genetic Algorithm revisitedGeneration 0
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
5/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Genetic Algorithm revisitedGeneration n
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
6/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
VLSI Design Problem
Figure :VLSI Design Problem
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
7/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
VLSI Design Problem - Traveling Salesman Problem
Problem changed for good reasons:
VLSI very little implementation details
VLSI faced problems had nothing to do with concurrency
TSP well known problem
TSP rich implementation details in literature (sequential)
TSP able to concentrade more on concurrency
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
8/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Traveling Salesman Problem
Find a route on a mapRequirements:
I Visit each City only once
I Find shortest path
Complexity (20 city):
I O(n!) (Brute Force, WC)
I 20! = 2.432902x1018
Figure :TSP Map
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
9/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Genetic Algorithm Operators
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
10/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Initialization
Figure :High Level Individual Representation
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
11/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Mutation
Figure :High Level Mutation Representation
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
12/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Crossover
Figure :High Level Crossover Representation
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
13/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Fitness Function
I Travelled distance over all city (inverse fitness)
I Each City has a location (x , y)
I Euclidean distance
I Fitness1 =∑n
i=1(xi−1 − xi )2 + (yi−1 − yi )
2
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
14/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Concurrency
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
15/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Concurrent Random Number Generator
Genetic Algorithms rely heavily on random numbers
I Math.random() is not concurrent
I Multiple threads use similar or same seeds
I ThreadLocalRandom 1
I Generator with an internally generated seed
I java.util.concurrent.ThreadLocalRandom
1http://docs.oracle.com/javase/7/docs/api/java/util/
concurrent/ThreadLocalRandom.html
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
16/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Threads and Islands
Each Thread represents one Island
I Genetic Algorithm (GA) Logic
I Implements Runnable
I Concurrent Execution
= GA’s Island Migration extension
Figure :Simplified UML-Class of CGaimIsland
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
17/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Threads and Islands
Each Thread represents one Island
I Genetic Algorithm (GA) Logic
I Implements Runnable
I Concurrent Execution
= GA’s Island Migration extension
Figure :Island Migration overview
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
18/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Threads and Barriers
Barriers2 for synchronization
I new CyclicBarrier(# Islands)
I Waits that all Islands are ready
I Evolution ↪→ random process
2http://docs.oracle.com/javase/7/docs/api/java/util/
concurrent/CyclicBarrier.html
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
19/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Island Migration
Sequentially (as proposed).
I Dependens on epoch length
I Joins all Threads
I Avoids shared memory access
I Performs cyclic Migration
I Copies Individuals
I Java’s array.clone()[i ]
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
20/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Island Migration
Sequentially (as proposed).
I Dependens on epoch length
I Joins all Threads
I Avoids shared memory access
I Performs cyclic Migration
I Copies Individuals
I Java’s array.clone()[i ]
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
21/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Some Results
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
22/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Some Results (Island Migration)
Figure :4 Islands - 150 Individuals - 2 Migrants - 70 Generations Epoch (≈ 5 Sec.)
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
23/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Some Results (Island Migration vs. Sequential)
Figure :100 City - Sequential (150 Individuals) vs. 4 Islands (as before)
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
24/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Future Work
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration
25/25
Genetic Algorithm revisited Genetic Algorithm Operators Concurrency Some Results Future Work
Future WorkI More tests / Parameter improvements
I intel i7 (8 cores x 4GHz) using 8 IslandsI 5 times faster than sequential GA on same machine
I More debuggingI bugs in MigrationI lack of .clone()I ...
I Execution time differences based on number of Islands
Markus Solbach York University
Implementation Report: Concurrent Genetic Algorithm with Island Migration