Download Sample Lecture - University of Calgary

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Genetic drift wikipedia , lookup

Dual inheritance theory wikipedia , lookup

Gene expression programming wikipedia , lookup

Koinophilia wikipedia , lookup

Population genetics wikipedia , lookup

Microevolution wikipedia , lookup

Transcript
CIS*6080
Genetic Algorithms
Instructor:
Robert Collier
E-mail:
[email protected]
Map Colouring
Colour the regions of a map such that adjacent nodes are assigned different colours.
Robert Collier
2
Graph Colouring Example
Colour the nodes such that adjacent nodes are assigned different colours.
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?
Robert Collier
3
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?
Colours
= { #FF0000, #0000FF, #007F00, #FF00FF }
Nodes
= { Node01, Node02, Node03, ..., Node 30}
Solution
= { Node01 = #FF0000, Node02 = #0000FF, ..., Node 30 = #007F00}
How many possible solutions are there?
4  4  4  4  4  ...  4 = 430
= 1 152 921 504 606 846 976
At a rate of 1 solution / second, how long will it take to check them all ?
1267650600228229401496703205376 / (60  60  24  365.25)
 36 533 877 880 years
Robert Collier
4
Graph Colouring Example
There may or may not be a perfect solution to this problem, but consider...
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.
Robert Collier
5
Definition: The Genetic Algorithm
The Genetic Algorithm is a Population Simulation that uses the
principles of Darwinian Evolution to solve Optimization Problems.
Robert Collier
6
Course Outline
Instructor:
Robert Collier
Office Hours:
E-mail:
Course Website:
Wednesdays (by appointment)
[email protected]
http://www.uoguelph.ca/~collierr/CIS6080/index.htm
Course Objectives:
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.
Robert Collier
7
Course Outline
Description:
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.
Evaluation:
Assignment 1
15%
Assignment 2
15%
Assignment 3
15%
Final Project
55%
Optional Bonus Assignment
10%
Robert Collier
8
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
Robert Collier
9
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.
Robert Collier
10
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
i.e. Does a particular entity meet certain criteria?
Search Problems
i.e. Where is a particular entity located in the space of all entities?
Counting Problems
i.e. How many of a particular entity are contained in the space of entities?
Robert Collier
11
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
Common Optimization Problems:
Map Colouring
Robert Collier
12
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
Common Optimization Problems:
Traveling Salesman
Sudbury
North Bay
Ottawa
Sudbury
North Bay
Ottawa
Kingston
Kingston
Toronto
London
Windsor
Robert Collier
Toronto
Hamilton
London
Hamilton
Windsor
13
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
Common Optimization Problems:
Knapsack Problem
50
30
100
Robert Collier
90
40
50
90
100
30
90
40
14
Simplistic Approaches
Exhaustive Approach
Every element of the set of feasible solutions can be tested.
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.
Consider the implications of these approaches?
Example: How can the minimum of y = x2 be found (without the derivative)?
F(x) =
Why look at neighbours?
Why the superior neighbour?
x=
Robert Collier
15
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=
Robert Collier
16
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=
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...
Robert Collier
17
Hill Climbing Approach
solution = selectRandomSolution()
best_fitness_so_far = getFitnessOf(solution)
other_solutions_remaining = TRUE
WHILE other_solutions_remaining
other_solutions_remaining = FALSE
other_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_solution
other_solutions_remaining = TRUE
END IF
END FOR
END WHILE
RETURN solution
Robert Collier
18
Simulated Annealing Approach
solution = selectRandomSolution()
current_fitness = getFitnessOf(solution)
temperature = starting_temperature
WHILE termination_criteria_not_met
neighbouring_solution = getRandomNeighbour(solution)
IF getFitnessOf(neighbouring_solution) > best_fitness_so_far
current_fitness = getFitnessOf(neighbouring_solution)
solution = neighbouring_solution
ELSE
IF random < exp(- (current_fitness - getFitnessOf(neighbouring_solution)) )
temperature
current_fitness = getFitnessOf(neighbouring_solution)
solution = neighbouring_solution
END IF
END IF
reduce(temperature)
END WHILE
RETURN solution
Robert Collier
19
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.
Robert Collier
20
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.
Robert Collier
21
Relevant Biology
Important Definitions
Robert Collier
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
22
Context for the Analogous Biology
Solutions to the map colouring problem discussed previously...
Colours
= { #FF0000, #0000FF, #007F00, #FF00FF }
Nodes
= { Node01, Node02, Node03, ..., Node 50}
Solution
= { Node01 = #FF0000, Node02 = #0000FF, ..., Node 50 = #007F00}
How could a chromosome be constructed from this information?
Possible Encodings:
String? Character? Integer? Binary? Other?
Integer Valued Chromosome
013213021302130132031230 ... 13203
Binary Chromosome
010100101111010101111010 ... 01011
Traits? Alleles? Loci?
Robert Collier
23
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.
Robert Collier
24
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.
Robert Collier
25
The Evolutionary Mechanism
“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”
Jean-Baptiste Lamarck
Philosophie Zoologique, 1809
... believed there were complexifying and adaptive forces at work
... believed that traits acquired over an organism's life could be transferred to offspring
Robert Collier
26
The Evolutionary Mechanism
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.
What are the key elements of this process?
Variation
Evaluation
Selection
Replication
Robert Collier
27
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.
Robert Collier
28
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.
Robert Collier
29
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.
The components of the evolutionary mechanism:
Robert Collier
Variation
Selection
Evaluation
Replication
30
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
Terminate?
Robert Collier
Population at Time t+1
The Evolutionary
Mechanism
31
Overview of the Genetic Algorithm
Initialization
Evaluation
Replication
Variation
Terminate?
false
Selection
true
Termination
Robert Collier
32
The remaining slides have been
omitted from this preview.
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.