cis*6080 genetic algorithms instructor:robert collier e-mail:[email protected]

33
CIS*6080 Genetic Algorithms Instructor: Robert Collier E-mail: [email protected]

Upload: forrest-gunnison

Post on 30-Mar-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

CIS*6080

Genetic Algorithms

Instructor: Robert Collier

E-mail:[email protected]

Page 2: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

2Robert Collier

Map Colouring

Colour the regions of a map such that adjacent nodes are assigned different colours.

Page 3: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

3Robert Collier

Graph Colouring Example

If the graph is planar, only four colours are necessary.

This graph isn't planar, so it might not be possible (with only four colours).

How many possible solutions (i.e. candidate solutions) exist?

Colour the nodes such that adjacent nodes are assigned different colours.

Page 4: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

4Robert Collier

Graph Colouring Example

The graph is made up of 30 nodes and this example is using 4 colours.

What would the solution (if one actually exists) actually look like?

How many possible solutions are there?

At a rate of 1 solution / second, how long will it take to check them all ?

Solution = { Node01 = #FF0000, Node02 = #0000FF, ..., Node 30

= #007F00}

Colours = { #FF0000, #0000FF, #007F00, #FF00FF }

Nodes = { Node01, Node02, Node03, ..., Node 30}

4 4 4 4 4 ... 4 = 430

= 1 152 921 504 606 846 976

1267650600228229401496703205376 / (60 60 24 365.25)

36 533 877 880 years

Page 5: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

5Robert Collier

Graph Colouring Example

The left solution violates 21 constraints while the right solution violates only 3.

Therefore we can conclude that the right solution is superior to the left.

Even if there is no perfect solution, there is a solution as good or better than all others.

There may or may not be a perfect solution to this problem, but consider...

Page 6: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

6Robert Collier

Definition: The Genetic Algorithm

The Genetic Algorithm is a Population Simulation that uses

the principles of Darwinian Evolution to solve Optimization

Problems.

Page 7: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

7Robert Collier

Course Outline

Instructor: Robert Collier

Office Hours: Wednesdays (by appointment)E-mail: [email protected] Website: http://www.uoguelph.ca/~collierr/CIS6080/index.htm

The primary objectives of this course are:

to introduce students to the simple genetic algorithm,

to explore each of the component processes that drive the

mechanism, and

to explore many of the different variations on these component

processes.

The secondary objective of this course is:

to teach students how to conduct a comparative evaluation of two

algorithms.

Course Objectives:

Page 8: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

8Robert Collier

This course introduces the student to basic genetic algorithms, which are based on the process of natural evolution. It is explored in terms of its mathematical foundation and applications to optimization in various domains.

Description:

Course Outline

Evaluation:

Assignment 1 15%

Assignment 2 15%

Assignment 3 15%

Final Project 55%

Optional Bonus Assignment 10%

Page 9: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

9Robert Collier

Course Overview

Lecture Topics:

Week 1 Foundational Material

Week 2 The Simple Genetic Algorithm

Weeks 3, 4 Component Process: Selection

Weeks 5, 6 Component Process: Variation

Weeks 7, 8 Component Process: Replication

Weeks 9, 10 Experimental Design and Statistical Analysis

Week 11 Genetic Programming, Artificial Life, etc.

Week 12 Learning Classifier Systems

Page 10: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

10Robert Collier

Foundational Material

The Genetic Algorithm is a Population Simulation that uses

the principles of Darwinian Evolution to solve Optimization

Problems.

Optimization Problems is the domain of problems to be solved.

Darwinian Evolution provided the inspiration for the technique.

Population Simulations model the environment where evolution was observed.

Page 11: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

11Robert Collier

Optimization Problems

The objective is to find the best possible solution from the set of feasible solutions.

This implies: a) that some solutions are better than others

b) there must be a way to quantify relative

superiority

Contrast the set of Optimization Problems with:

Decision Problems

Search Problems

Counting Problems

i.e. Does a particular entity meet certain criteria?

i.e. Where is a particular entity located in the space of all entities?

i.e. How many of a particular entity are contained in the space of entities?

Page 12: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

12Robert Collier

Optimization Problems

The objective is to find the best possible solution from the set of feasible solutions.

This implies: a) that some solutions are better than others

b) there must be a way to quantify relative

superiority

Map Colouring

Common Optimization Problems:

Page 13: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

13Robert Collier

Windsor

London Hamilton

Toronto

Sudbury

Kingston

OttawaNorth Bay

Optimization Problems

The objective is to find the best possible solution from the set of feasible solutions.

This implies: a) that some solutions are better than others

b) there must be a way to quantify relative

superiorityCommon Optimization Problems:

Traveling Salesman

Windsor

London Hamilton

Toronto

Sudbury

Kingston

OttawaNorth Bay

Windsor

London Hamilton

Toronto

Sudbury

Kingston

OttawaNorth Bay

Page 14: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

14Robert Collier

90

100

50

40

30

90

Optimization Problems

The objective is to find the best possible solution from the set of feasible solutions.

This implies: a) that some solutions are better than others

b) there must be a way to quantify relative

superiorityCommon Optimization Problems:

Knapsack Problem

90

100

50

4030

Page 15: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

15Robert Collier

Simplistic Approaches

Exhaustive Approach

Every element of the set of feasible solutions can be tested.

F(x) =

x =

Greedy Approach

A candidate solution can often be constructed in stages, and the

component added at each stage is the one offering the most immediate

benefit.

Example: How can the minimum of y = x2 be found (without the

derivative)?

Consider the implications of these approaches?

Why look at neighbours?

Why the superior neighbour?

Page 16: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

16Robert Collier

Complex Candidate Solution Spaces

The set of candidate solutions is typically a space of candidate

solutions...

... however, this space can be very complex.

F'(x) =

x =

Page 17: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

17Robert Collier

Complex Candidate Solution Spaces

The set of candidate solutions is typically a space of candidate

solutions...

... however, this space can be very complex.

For a two dimensional solution (i.e. an ordered pair (x, y)),

the space is often conceptualized as a landscape.

An intuitive approach directly results from this analogy...

F'(x) =

x =

Page 18: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

18Robert Collier

Hill Climbing Approach

solution = selectRandomSolution()best_fitness_so_far = getFitnessOf(solution)other_solutions_remaining = TRUE

WHILE other_solutions_remainingother_solutions_remaining = FALSEother_solutions = getNeighbouringSolutions(solution)FOR EACH neighbouring_solution IN other_solutions

IF getFitnessOf(neighbouring_solution) > best_fitness_so_far

best_fitness_so_far = getFitnessOf(neighbouring_solution)

solution := neighbouring_solutionother_solutions_remaining = TRUE

END IFEND FOR

END WHILE

RETURN solution

Page 19: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

19Robert Collier

Simulated Annealing Approach

solution = selectRandomSolution()current_fitness = getFitnessOf(solution)temperature = starting_temperature

WHILE termination_criteria_not_metneighbouring_solution = getRandomNeighbour(solution)IF getFitnessOf(neighbouring_solution) > best_fitness_so_far

current_fitness = getFitnessOf(neighbouring_solution) solution = neighbouring_solution

ELSEIF random < exp(- (current_fitness -

getFitnessOf(neighbouring_solution)) )temperature

current_fitness = getFitnessOf(neighbouring_solution) solution = neighbouring_solution

END IFEND IFreduce(temperature)

END WHILE

RETURN solution

Page 20: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

20Robert Collier

Summary of Optimization Problems

Optimization Problems are solved by finding the best possible solution

(i.e. the optima) from the space of candidate solutions.

Some candidate solutions are better than others.

Some candidate solutions are closer together and some are further apart.

Candidate solution spaces are often complex, and hill climbing alone is not sufficient (as they become trapped at local optima)

Processes observed in the natural world (i.e. annealing, evolution) can serve as inspiration for effective optimization

approaches.

Page 21: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

21Robert Collier

Foundational Material

The Genetic Algorithm is a Population Simulation that uses

the principles of Darwinian Evolution to solve Optimization

Problems.

Optimization Problems is the domain of problems to be solved.

Darwinian Evolution provided the inspiration for the technique.

Population Simulations model the environment where evolution was observed.

Page 22: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

22Robert Collier

Relevant Biology

Chromosome a structure defining an organism's properties

Gene a component of a chromosome

Trait a property encoded by one of more genes

Allele a possible value setting for a trait

Locus a position in a chromosome

Genotype the genetic constitution of an organism

Phenotype the physical constitution of an organism

Important Definitions

Page 23: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

23Robert Collier

Context for the Analogous Biology

Solution = { Node01 = #FF0000, Node02 = #0000FF, ..., Node 50

= #007F00}

Solutions to the map colouring problem discussed previously...

Colours = { #FF0000, #0000FF, #007F00, #FF00FF }

Nodes = { Node01, Node02, Node03, ..., Node 50}

How could a chromosome be constructed from this information?

Possible Encodings: String? Character? Integer? Binary? Other?

Integer Valued Chromosome 013213021302130132031230 ... 13203Binary Chromosome010100101111010101111010 ... 01011

Traits? Alleles? Loci?

Page 24: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

24Robert Collier

Biomimicry and the Natural World

Leonardo Da Vinci's sketch of a flying machine was inspired by the form of a bird.

Biomimicry uses natural processes as inspiration for solving problems. Why?

... because the natural world has solved many complex problems. How?

... through the process of natural selection.

Page 25: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

25Robert Collier

Natural Selection

The process by which traits become more or less common,

according to the survival and/or reproduction of organisms with those

traits.

carbonaria

typica

These moths are an example of a solution to the problem of camouflage.

Page 26: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

26Robert Collier

The Evolutionary Mechanism

Jean-Baptiste Lamarck

Philosophie Zoologique, 1809

“as new modifications will necessarily continue to operate, however slowly, not only will there continually be found new species, new genera, and new orders, but each species will vary in some part of its structure and form ... individuals which from special causes are transported into very different situations from those where the others occur, and then constantly submitted to other influences - the former, I say, assume new forms, and then they constitute a new species”

... believed that traits acquired over an organism's life could be transferred to offspring

... believed there were complexifying and adaptive forces at work

Page 27: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

27Robert Collier

Instead of Lamarck's complexifying force, genetic variation causes diversity in the chromosomes of living things, and those better suited to their environment are more likely to survive and pass the various traits to their offspring.

Darwin proposed the process of Natural Selection

Instead of Lamarck's complexifying force, genetic variation causes diversity in the chromosomes of living things, and those better suited to their environment are more likely to survive and pass the various traits to their offspring.

The Evolutionary Mechanism

What are the key elements of this process?

Variation

Evaluation

Selection

Replication

Page 28: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

28Robert Collier

Summary of Darwinian Evolution

Genetic algorithm terminology borrows heavily from biology.

The natural world has already solved many complex problems.

Natural selection states that variations appear in populations, and those variations that are beneficial are transmitted to

future generations.

The component processes of the evolutionary mechanism are:Evaluation, Selection, Variation, and Replication

Any system with these processes is an evolving system.

Page 29: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

29Robert Collier

Foundational Material

The Genetic Algorithm is a Population Simulation that uses

the principles of Darwinian Evolution to solve Optimization

Problems.

Optimization Problems is the domain of problems to be solved.

Darwinian Evolution provided the inspiration for the technique.

Population Simulations model the environment where evolution was observed.

Page 30: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

30Robert Collier

Simulation Basics

"The imitation of the operation of a real-world process or system over time."

A population of organisms ...

... in which the likelihood that an organism survives or reproduces is

proportional

the degree to which that organism can solve a particular optimization

problem.

Evaluation

SelectionVariation

Replication

The components of the evolutionary mechanism:

Page 31: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

31Robert Collier

Population Simulation

Two Simplifying Assumptions:

1. Each member of the population lives for exactly one

generation.

2. The population size never changes (i.e. complete

replacement)Population at Time t Population at Time t+1

Terminate?

The EvolutionaryMechanism

Page 32: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

32Robert Collier

Overview of the Genetic Algorithm

Initialization

Evaluation

Selection

Variation

Replication

Terminate?

Termination

true

false

Page 33: CIS*6080 Genetic Algorithms Instructor:Robert Collier E-mail:collierr@uoguelph.ca

This graduate level course in genetic algorithms was developed and taught by Robert Collier, MSc,

BSc.

It was most recently offered at the University of Guelph during the

summer 2011 semester.

The remaining slides have been omitted from this

preview.