implementation report: concurrent genetic algorithm with

25
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 Vision Department 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

Upload: others

Post on 28-Apr-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Implementation Report: Concurrent Genetic Algorithm with

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

Page 2: Implementation Report: Concurrent Genetic Algorithm with

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

Page 3: Implementation Report: Concurrent Genetic Algorithm with

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

Page 4: Implementation Report: Concurrent Genetic Algorithm with

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

Page 5: Implementation Report: Concurrent Genetic Algorithm with

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

Page 6: Implementation Report: Concurrent Genetic Algorithm with

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

Page 7: Implementation Report: Concurrent Genetic Algorithm with

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

Page 8: Implementation Report: Concurrent Genetic Algorithm with

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

Page 9: Implementation Report: Concurrent Genetic Algorithm with

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

Page 10: Implementation Report: Concurrent Genetic Algorithm with

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

Page 11: Implementation Report: Concurrent Genetic Algorithm with

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

Page 12: Implementation Report: Concurrent Genetic Algorithm with

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

Page 13: Implementation Report: Concurrent Genetic Algorithm with

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

Page 14: Implementation Report: Concurrent Genetic Algorithm with

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

Page 15: Implementation Report: Concurrent Genetic Algorithm with

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

Page 16: Implementation Report: Concurrent Genetic Algorithm with

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

Page 17: Implementation Report: Concurrent Genetic Algorithm with

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

Page 18: Implementation Report: Concurrent Genetic Algorithm with

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

Page 19: Implementation Report: Concurrent Genetic Algorithm with

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

Page 20: Implementation Report: Concurrent Genetic Algorithm with

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

Page 21: Implementation Report: Concurrent Genetic Algorithm with

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

Page 22: Implementation Report: Concurrent Genetic Algorithm with

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

Page 23: Implementation Report: Concurrent Genetic Algorithm with

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

Page 24: Implementation Report: Concurrent Genetic Algorithm with

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

Page 25: Implementation Report: Concurrent Genetic Algorithm with

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