davidson machine learning scotty chung · genetic algorithms in search, optimization, and machine...

29
Genetic Algorithms Scotty Chung Davidson Machine Learning

Upload: lyngoc

Post on 07-Jul-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Genetic Algorithms

Scotty ChungDavidson Machine Learning

Outline

What is a GA (Genetic Algorithm)?

Solution Encoding

Crossover

Mutation

How do GAs work?

Let’s build one

Properties of GAs

Modern applications

Spallation Neutron Source beam loss

GA implementation

Goals of Presentation

Able to answer “What is a genetic algorithm?”

Comfortable with a simple implementation

Know when to use a Genetic Algorithm

What is a Genetic Algorithm?

Global optimization technique

Inspired by natural selection process

One of several evolutionary computation family

Most notable figure John Holland (1970) and David Goldberg (1989)

[1]

What is Natural Selection?

Variation in population

Properties that increase or decrease

fitness

Good properties are more likely

passed down to offspring

[2]

Simplified Biology and Genetics

Chromosome structure contain building blocks for organism

Fitness of organism from chromosomes

Chromosomes passed to offspring

[3]

Represent Solutions as Chromosome

Treat solutions to our problems like organisms with chromosomes

Then utilize natural selection to arrive at optimum

Solution encoding

Encode solutions to have same chromosome properties

Different types depending on the problem

Binary encoding

Permutation encoding

Value encoding

Solution encoding - Binary

Example Problem: Knapsack

Given a set of differently weighted and valued items, fill a weight capacity knapsack so it is the most valuable.

1 - Item is in bag

0 - Item is not in bag

Solution 1 0101011110100001

Solution 2 1110001010111001

Solution encoding - Permutation

Example Problem: Traveling Salesperson

Given a set of locations to visit, find the order which minimizes the distance traveled.

[ 2, 1, 4, 3 ] - [ LA, NYC, Seattle, Raleigh ]

Solution 1 25461378

Solution 2 54716238

Solution encoding - Value

Example Problem: Neural Network Weights

Given a neural network architecture, find weights to train the neural network for desired output.

Solution 1 1.231 2.412 5.222

Solution 2 3.124 5.112 3.123

Crossover

Generate offspring with characteristics from both parents

Types:

Single-Point

Two-Point

Uniform

Crossover

How do GAs work?

1. Initialization

Create a population of members

2. Evaluation

Test a member’s fitness

3. Crossover

Create a new generation

4. Mutation

Tweak a member at low rate

Let’s build one

Simplified Mastermind

User selects color array

GA attempts to find users solution

GA only receives fitness value

Value Encoding:

[ 0, 3, 1 , 2 ] = [ red, yellow, green, blue ]

Let’s build one

// Initialization

Until $size of $population:

Generate random $member;

Repeat following until $generation_limit or exact solution is found

// Evaluation

For $member of $population:

Evaluate $member fitness;

// Crossover (using single-point alpha)

For $member of $population:

Create child from $member and $elite

// Mutation

For $member of $population:

If mutation_rate:

Mutate $member

Let’s build one

// Initialization // Evaluation

Let’s build one

// Crossover

Let’s build one

// Mutate scottychung.com

GA Variations

Initialization

Random

Seeded

Crossover

Single Point

Two-Point

Uniform

Mutation (Less Restrictive)

Single Point

Floating Point

Mutation (More Restrictive)

Swap

Inversion

Scrambles

GA Properties

Global Search

Find global optimum

Search undesired areas

Population based

Parallelism

Frequent cost function evaluation

Metaheuristics

Non-greedy. Handle new information

Takes bad steps

Stochastic

Unrepeatable

Requires Specific Encoding

Fitness Function

Modern Applications of GAs

Optimization and training of Predictive Models

Computer-automated design

Fan blades

Exterior lighting design

High strength low weight Cranes

Baseline evaluations

Hybridization

Evolutionary Programming

SNS Beam Loss

Generates high velocity neutron particles

Accelerates electrons then bombards neutron source

Has to focus and steer electron beam to source

Tuning of machine perform by hand

SNS Beam Loss

Solution Encoding

Magnet Values

Fitness function

Inverse of Mean Squared Error of Beam Loss

Crossover

Single Point

Mutation

Single Point

SNS Beam Loss Before

SNS Beam Loss - After

SNS Beam Loss

Succeeded

Reduction in beam loss

Tuning completed in less than

hour

Areas of Improvement

Better encoding to capture input

properties

Different algorithm approach

based problem

Reference

Images

[1] https://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Darwin's_finches_by_Gould.jpg/220px-Darwin's_finches_by_Gould.jpg

[2] https://ghr.nlm.nih.gov/chromosome/9/ideogram.png

[3] https://s3.amazonaws.com/gs-geo-images/c32a70b5-8d1f-4469-b359-725dcc309971.jpg

[4] https://www.sharcnet.ca/Software/Ansys/15.0.7/en-us/help/wb_dx/graphics/dx_theory_moga-crossover.png

Material

http://www.obitko.com/tutorials/genetic-algorithms/encoding.php

Genetic Algorithms in Search, Optimization, and Machine Learning 1st Edition by David E. Goldberg