Logistics Assignments Crossover and Mutation Checkpoint 1 -- - - PDF document

logistics
SMART_READER_LITE
LIVE PREVIEW

Logistics Assignments Crossover and Mutation Checkpoint 1 -- - - PDF document

Logistics Assignments Crossover and Mutation Checkpoint 1 -- Problem Graded -- comments on mycourses Checkpoint 2 --Framework Mostly all graded -- comments on mycourses Checkpoint 3 -- Genotype / Phenotype Due last


slide-1
SLIDE 1

1

Crossover and Mutation

Logistics

 Assignments

 Checkpoint 1 -- Problem  Graded -- comments on mycourses  Checkpoint 2 --Framework  Mostly all graded -- comments on mycourses  Checkpoint 3 -- Genotype / Phenotype  Due last Wednesday  Grading not started  Checkpoint 4 -- Selection / Fitness  Due October 19 (Friday)

Final exam date

 Final exam date has been announced:

 Friday, November 16th  2:45pm - 4:45pm  70-1445

 However…

Project Presentation

12 Projects

Presentations:

Dates:

 Week 10 

Monday, November 5

Wednesday, November 7

15 minutes / presentation

Schedule now on Web

Please send me choice of time/day

Code, Report, and Grad Survey

DUE FRIDAY, NOV 9th

Plan for this week

 Today:

 Crossover and Mutation

 Wednesday:

 Guest Speaker: Peter Anderson  GAs and permutations.

 Questions before we start

Evolutionary Algorithms

 An EA uses some mechanisms inspired by biological

evolution: reproduction, mutation, recombination, natural selection and survival of the fittest.

 Candidate solutions to the optimization problem play

the role of individuals in a population, and the cost function determines the environment within which the solutions "live".

 Evolution of the population then takes place after the

repeated application of the above operators.

slide-2
SLIDE 2

2

Evolutionary Computation process

Initialize population Select individuals for crossover (based on fitness function Crossover Mutation Insert new offspring into population Are stopping criteria satisfied? Finish

Evolutionary Algorithms

 To use evolutionary algorithms your must:

 Define your problem  Define your genotype  Identify your phenotype  Define the genotype -> phenotype translation  Define crossover and mutation operators  Define fitness  Determine selection criteria  Set population parameters

Reproduction

Reproduction

Generation k Generation k+1

Fitness

Individual

Phenotype Genotype

problem

parameters

  • utput

Fitness

fitness

Reproduction

 Means by which new individuals are produced

 Crossover

 Combination of 2 parents  Best of both parents

 Mutation

 modification of a single individual  Allows for random search through search space.

 Genetic operators are applied on the

genotype.

Exploration vs. Exploitation

 Exploration

 random variation and selection to determine

strategies that fit the environment

 diversity  Mutation

 Exploitation

 focused repetition of the fittest behavior in the

stage of retention.

 Selective pressure  Crossover

slide-3
SLIDE 3

3

Exploration vs Exploitation

 Challenge is to maintain balance.

 Too much exploration:

 random search

 Too much exploitation

 Get stuck local optima

Crossover

 Combination of the best of both

parents.

 Building blocks

Crossover on Strings / Arrays

 Common mechanisms:

 One-Point Crossover  Two-Point Crossover  Cut and Splice  Uniform and Half-Uniform Crossover  Arithmetic  Heuristic

One-Point Crossover

 Crossover point on the parent string is

selected.

 All data beyond that point is swapped

between the two parents

Two-Point Crossover

 Two points are selected on the parent

strings.

 Everything between the two points is

swapped between the parents

Cut and Splice

 Like one-point crossover, except each

parent has a different cut point

 Can result in variable length children.

slide-4
SLIDE 4

4

Uniform Crossover and Half Uniform Crossover

 uniform crossover scheme (UX)

 individual genes are compared between

two parents.

 The gene values are swapped with a fixed

probability, typically 0.5.

 half uniform crossover scheme (HUX)

 exactly half of the nonmatching genes are

swapped.

Arithmetic (Numerical arrays)

 linearly combines two parent chromosome

vectors to produce two new offspring according to the following equations:

 Offspring1 = a * Parent1 + (1- a) * Parent2  Offspring2 = (1 – a) * Parent1 + a * Parent2  a = randomly determined constant.

Heuristic (Numerical Arrays)

 uses the fitness values of the two parent

chromosomes to determine the direction of the search. The offspring are created according to the following equations:

 Offspring1 = BestParent + r * (BestParent –

WorstParent)

 Offspring2 = BestParent

 where r is a random number between 0 and

1.

GPs: Crossover and Mutation

Before crossover After crossover

crossover mutation

Before mutation After mutation

 Note that operation maintain valid

individuals.

Mutation

 Random modification of a single

individual

 Explore new areas of search space  Avoids getting stuck in local

minima/maxima.

Standard Mutation

 Bit String

 Flip a bit

 Array

 Modify gene by random amount

 Trees

 Replace branch with random subtree.

slide-5
SLIDE 5

5 Bad genomes and reproduction

 Dealing with bad genomes

 Total Rejection  Genetic Repair

 fix in genetic mapping

 Genetic operators  Fitness Penalties.

 Break

Traveling Salesman Problem

 Instance:

 N cities with distances between pairs of

cities

 Said another way:

 Complete graph with n vertices such that all

edges are labeled with a cost value

 Example of a permutation problem

Traveling Salesman Problem

 Solution:

 Tour of the cities such that each city is visited once.  Said another way:  A permutation of the cities.  Ordered list of the cities

 Is this a large search space?

 n cities = n! permutation

Traveling Salesman Problem

 Output:

 Distance traveled to complete the tour.

 Complete treatment

 From [Larranaga, et. al. 1999]

 Recall:

 Phenotype == ordered tour of the cities

TSP - Path Representation

 Tour is represented as an ordered list

(or array) of the cities.

 Order in array == order of visitation.  If city i is the jth element of the array, city

i is the jth city to be visited.

 Eg.

Tour: 3-2-4-1-7-5-8-6

6 8 5 7 1 4 2 3

TSP - Path Representation

 Most intuitive and common genotype.  But it has it’s problems: 6 8 5 7 1 4 2 3 1 2 3 4 5 6 7 8 1 2 3 4 1 4 2 3 6 8 5 7 1 4 2 3 6 8 5 3 1 4 2 3

Not valid tours!!!

slide-6
SLIDE 6

6

TSP - Path Representation

 GeneRepair [Mitchell, et.al.]

 Keep a corrective template with a valid

tour.

 Identify duplicate cities  Use template to replace duplicate cities.

TSP - Path Representation

 Genetic Mapping responsible for doing

the repair on a “bad genome”

 Most approaches that use the path

representation use designer crossover/mutation operators

 Assure valid offspring.

Designer crossover operators

 Designed for a particular application.  Problem domain constraints

 Phenotype constraints

 Still operates on genotype.  Goal: Prevent bad genomes

Partially Mapped Crossover (PMX)

 Portion of one parent is mapped to a portion

  • f another parent

 Remaining info is exchanged  How it works:

 Choose two random cut points  Define mapping  Copy mapping section (between cut points) to

  • ffspring

 Fill in remainder of offspring using mapping

Partially Mapped Crossover (PMX)

8 7 6 5 4 3 2 1 4 2 8 6 1 5 7 3

parents

  • ffspring

4 5 6 8 6 1 4 3 2 3 7 5 7 8 2 1

Partially Mapped Crossover (PMX)

slide-7
SLIDE 7

7

Cycle Crossover (CX)

 Creates an offspring where every

position is occupied by a corresponding element from one of the parents

Cycle Crossover (CX)

8 7 6 5 4 3 2 1 1 3 5 7 8 6 4 2

parents 5 7 4 1 2 6 3 8

  • ffspring

Cycle Crossover (CX)

 Absolute position of (on average) half

elements of both parents preserved.

 Better results for TSP than PMX.

Order Crossover (OX)

 Observes that order is important, not

necessarily position.

 How it works:

 Choose 2 cut points  Copy between cut points to offspring  Starting from 2nd cut point in one parent,

fill missing cities in order they appear in

  • ther parent.

Order Crossover (OX)

8 7 6 5 4 3 2 1 1 3 5 7 8 6 4 2

parents

  • ffspring

1 1 4 8 5 7 8 6 2 3 7 4 5 3 2 6

Edge Recombination Crossover (ER)

 Creates a path (offspring) that is similar

to a set of existing paths (parents) by looking at the edges rather than the vertices.

slide-8
SLIDE 8

8

Edge Recombination Crossover (ER)

 Edge Map

 For each node, gives list of other nodes to

which it has an edge in either parent CABDEF ABCEFD

A: B C D B: A C D C: A B E F D: A B E F E: C D F F: C D E

Edge Recombination Crossover (ER)

 Algorithm

 Let K be the empty list  Let N be the first node of a random parent.  While Length(K) < Length(Parent):  K := K + N (append N to K)  Remove N from all neighbor lists  If N's neighbor list is non-empty then  let N* be the neighbor of N with the fewest neighbors

in its list (or a random one, should there be multiple)

 else let N* be a randomly chosen node that is not in K  N := N*

Edge Recombination Crossover (ER)

A: B C D B: A C D C: A B E F D: A B E F E: C D F F: C D E K = {} K = A K = AB K = ABD K = ABDFC K = ABDFCE K = ABDF

Mutation

 Similar problem for standard mutation 6 8 5 7 1 4 2 3 6 8 5 7 3 4 2 3

Not a valid tour

Displacement Mutation

 Aka Cut Mutation  How it works:

 Select a subtour at random  Insert it in a random place

6 8 5 7 1 4 2 3 6 8 1 4 2 5 7 3

Exchange Mutation

 Randomly selects two cities and swaps 6 8 5 7 1 4 2 3 6 8 5 4 1 7 2 3

slide-9
SLIDE 9

9

Insertion Mutation

 Randomly choose a city  Remove it and insert in a random place  Like displacement with a subtour of 1 6 8 5 7 1 4 2 3 6 4 8 5 7 1 2 3

Simple Inversion Mutation

 Choose two cut points  Reverse subtour between cuts 6 8 5 7 1 4 2 3 6 8 5 4 1 7 2 3

Scramble Mutation

 Choose a random subtour and scramble 6 8 5 7 1 4 2 3 6 8 4 5 7 1 2 3

TSP

 Seen enough?  For complete list see [Larranaga 1999]  Questions?

Take Home Messages

 Reproduction  Types

 Crossover  Mutation

 Designer Operators for Given Problem

Next time

 APPLICATION:

 Peter Anderson: GAs and permutations.  CP5: Crossover / Mutation