Download Evolutionary Computation - Artificial Inteligence - Lecture Slides and more Slides Artificial Intelligence in PDF only on Docsity!
Evolutionary Computation
What is evolutionary
computation?
Any of a number of
techniques/approaches based on or
inspired by natural evolution, e.g.
Genetic algorithms Genetic programming
Natural evolution
Adaptation based on a combination of
competition (e.g. for food), selection
(i.e. surviving long enough to be able to
reproduce in a given enviroment),
mutation (i.e. spontaneous change in
the gene itself), and reproduction (i.e.
producing a new individual with the
same or similar genetic makeup).
Evolutionary fitness
The ability of an individual (or a population) to survive and reproduce in a given environment. Darwinian evolution optimizes evolutionary fitness. As environmental conditions change so does the adaptive topology – the multidimensional fitness function. In other words, the goalposts are always moving.
Genetic algorithms
What are GAs?
A class of stochastic (i.e. probabilistic) search algorithms based on biological evolution. Rely on well-defined termination criteria and fitness functions. Nodes in the search space (i.e. potential solutions) are represented as chromosomes (typically a binary series). Each element in a chromosome is called a gene.
Docsity.com
A GA run
- Initialization. Represent the problem domain as a chromosome of length L. Choose population size (N), crossover probability (pc) and mutation probability (pm).
- Define a fitness function, which quantitatively measures the success of an individual chromosome.
- Randomly generate an initial population of size N.
- Calculate the fitness of each chromosome. If the termination condition is satisfied, stop. Otherwise, continue.
A GA run (2)
- Select parent chromosomes probabilistically, based on their fitness.
- Apply the genetic operators (crossover and mutation)
- Place the generated offspring in the new population. Repeat from 5 until population size is N.
- Repeat from 4, with the new population.
Representing candidate
solutions as chromosomes
A chromosome is typically a binary string (although other representations exist). If potential solutions are numbers, or series of numbers, then encoding in this representation is straightforward. If potential solutions are more complex entities, encoding can be the hardest part of the problem!
The fitness function
Should be a relatively simple (i.e. quick to calculate) measure of an individual‟s fitness (i.e. how close it is to a solution). A domain-specific, heuristic measure In a GA, N individuals are evaluated in each generation, and there are typically many (hundreds or thousands) of generations – so a complex fitness function can slow things down a lot. Coming up with a good fitness function can also be very difficult! Try a weighted sum of desirable features…
The crossover operator
Corresponds to bisexual reproduction in natural selection (typically, pc=.7). If it fires:
- A point in the length of the parent chromosomes is randomly selected.
- The two offspring are:
- The first part of Parent A plus the second part of Parent B, and
- The first part of Parent B plus the second part of Parent A. If it doesn‟t fire, the offspring are (typically) simply reproductions of the parents.
Other kinds of crossover
Multi-point crossover: As before, but
with several points selected.
Uniform crossover: Genes are randomly
selected from each parent.
Arithmetic crossover: The offspring‟s
genes are some function of parents‟,
e.g. AND.
Docsity.com
What is genetic programming?
Like GAs, GPs use evolutionary techniques to solve problems. Unlike GAs, the solutions are programs. The goal is to produce programs which can solve problems, without explicitly programming them. Chromosomes are both data (i.e. can be manipulated) and programs (i.e. can be run to determine fitness).
The GP process
- Determine the set of terminals (i.e. inputs to the program)
- Select the set of primitive functions (e.g. the set of mathematical operators, or perhaps more sophisticated functions)
- Define the fitness function. Typically, the sum of the absolute errors over a number of fitness cases (sample inputs).
- Determine key parameters (e.g. population size, max number of generations, as with GAs).
- Run as with GAs.
Encoding programs as
chromosomes
Consider the LISP „program‟:
(/ (- (sqrt (+ (* a a)(- a b))) a)(* a b))
Which is equivalent to:
ab
a ( a b ) a
2
Which can be represented as
the tree:
a a
a b
sqrt a
a b
/
Crossover
A branch is randomly chosen as the
crossover point, e.g.:
a a
a b
sqrt a
a b
/ Fragment to be exchanged with fragment from other parent
Crossover example (parents)
a a
a b
sqrt a
a b
/ b a
sqrt b (^) b
b - /
Docsity.com
a b
Crossover example (children)
b (^) b
b /
b a
sqrt
a a
a b
sqrt a
/
Mutation
There are two types of mutation:
An operator node can be randomly
changed to another operator
A terminal node can be randomly
changed to another terminal.
Methods for generating the
initial population
Full: Selects operators until the tree is
of a certain depth, then selects
terminals.
Grow: Selects operators or terminals
until a certain depth, then terminals
only.
Ramped half-and-half: Combines the
above methods, for maximum diversity
in initial population.
Ramped half and half
1. For i from 2 to max-initial-depth:
- Generate (50/max-initial-depth-1)% of the population using the “full” method with maximum depth i
- Generate the rest of the population using the “grow” method with maximum depth i.
Fitness-based selection
methods:
Probabilistically based on fitness
Tournament: Potential mates for a
given individual are compared, and the
fittest is chosen
Ranking: Individuals are ranked based
on fitness, and top individuals are
chosen.
Example:
http://alphard.ethz.ch/gerber/approx/d
efault.html
Play with the settings. Do you
understand what‟s going on here? Note
that you can enter a new equation to
learn under “fitness cases” in settings:
give the eqn after “//” and then a
number of X-Y pairs that solve the eqn
as fitness cases.
Docsity.com
Step 5: Run the GA
1. Choose population size N and stopping
condition (max number of generations
and/or fitness threshold).
2. Generate initial population.
3. Stopping condition met? If so, stop.
4. Generate new population, and go to 3.
Another exercise:
Design a GA that can generate an observation schedule (1 night) for an automatic telescope. A schedule is an ordered list of observations selected from a set of observation requests. Each observation has a different viewing window (e.g. Mars can be seen between 1am and 3am), location in the sky, probability of success, and priority. The schedule should (in order of importance): minimize the amount of time during the night that the telescope is idle, maximize the priority of the scheduled observations, maximize the probability of success, and minimize the distance moved between observations.
Docsity.com