0% found this document useful (0 votes)
2 views

Lecture 5 - Evolutionary algorithms

Evolutionary algorithms (EAs) are optimization techniques inspired by natural selection, designed to efficiently explore complex search spaces. They utilize population-based search and genetic operators such as selection, crossover, and mutation, making them applicable across various domains like AI, engineering, and finance. EAs are particularly effective for global optimization, handling high-dimensional problems while being less prone to local optima compared to traditional methods.

Uploaded by

shaikham2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture 5 - Evolutionary algorithms

Evolutionary algorithms (EAs) are optimization techniques inspired by natural selection, designed to efficiently explore complex search spaces. They utilize population-based search and genetic operators such as selection, crossover, and mutation, making them applicable across various domains like AI, engineering, and finance. EAs are particularly effective for global optimization, handling high-dimensional problems while being less prone to local optima compared to traditional methods.

Uploaded by

shaikham2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Introduction to AI

Systems

Lecture 5
Evolutionary algorithms
Lecture 3
Evolutionary algorithms

1: INTRODUCTION TO 2: EVOLUTIONARY 3: COMPONENTS OF 4: BINARY, INTEGER 5: PERMUTATION AND 6: EXAMPLE OF A


EVOLUTION ALGORITHMS AN EVOLUTIONARY AND REAL-VALUED TREE-BASED SIMPLE EVOLUTIONARY
ALGORITHM REPRESENTATIONS REPRESENTATIONS ALGORITHM
Lecture 3
Evolutionary algorithms

1: Introduction to evolution
Evolutionary Algorithms:
Introduction
Motivation:
•Many real-world problems are complex, non-linear, and multi-
dimensional, making traditional optimization methods ineffective.
•Inspired by natural selection, evolutionary algorithms provide a
robust solution to explore large search spaces efficiently.
Key Concepts:
•Population-based search: Simulates a group of potential solutions
evolving.
•Natural selection mechanisms: Processes like selection, crossover,
and mutation drive the evolution of solutions.
Why Important:
•Scalability: Can handle complex, high-dimensional problems.
•Flexibility: Applicable across various domains like AI, engineering,
and economics.
•Global optimization: Less prone to getting stuck in local optima
than traditional methods.
Why Draw Inspiration from Evolution?
Video from https://www.youtube.com/ watch?v=g0TaYhjpOfo
Video from https://www.youtube.com/ watch?v=T- c17RKh3uE
Evolution
• Biological evolution:
• Lifeforms adapt to a particular environment over successive
generations.
• Combinations of traits that are better adapted tend to increase
representation in population.
• Mechanisms: Variation (Crossover, Mutation) and Selection (Survival of
the fittest).
• Evolutionary Computing (EC):
• Mimic the biological evolution to optimize solutions to a wide variety of
complex problems.
• In every new generation, a new set of solutions is created using bits
and pieces of the fittest of the old.
Lecture 3
Evolutionary algorithms

2: Evolutionary algorithms
Y
Evolutionary algorithms

•Inspired by Natural Evolution:


Evolutionary algorithms (EAs) are
optimization techniques inspired by the
process of natural selection and genetics in
biological evolution.
•Key Concepts:
•Population-Based Search: EAs work with a
population of potential solutions rather than a
S

single solution.
•Genetic Operators:
Selection: Favors better solutions to
pass their "genes" to the next generation.
Crossover (Recombination): Combines
parts of two or more solutions to create
new offspring.
Mutation: Introduces random changes to
individuals to maintain genetic diversity.
•Aerospace Design (NASA):
Used to optimize spacecraft components, such as antenna
designs, improving communication efficiency while minimizing
weight.

Evolutionary •Robotics:
EAs evolve optimal walking gaits and control systems for robots,
enhancing adaptability to different environments and improving
algorithms – precision.
•Traffic and Transportation Optimization:
Area of Applied to synchronize traffic lights and optimize vehicle routing,
reducing congestion and improving fuel efficiency in urban

Application
transport systems.
Manufacturing and Scheduling:
In industries like automotive and electronics manufacturing, EAs are
used for optimizing production schedules and workflows. They help in
minimizing production time, reducing waste, and optimizing the use of
machinery and labor.
•Finance (Trading and Portfolio Management):
•Used for evolving trading strategies that adapt to market
conditions, optimizing investment returns, and managing financial
risks.
General scheme of EAs
EA scheme in pseudo-code
Scheme of an EA:
Two pillars of evolution
There are two competing forces
&
-
Increasing population diversity Decreasing population diversity by
by genetic operators selection
 of parents
 mutation
 of survivors
 recombination

Push towards quality


Push towards novelty
Lecture 3
Evolutionary algorithms

3: Components of an evolutionary algorithm


Main EA components: Evaluation
(fitness) function
• Represents the task to
solve
• Enables selection (provides
basis for comparison)
• Assigns a single real-
valued fitness to each
phenotype
General scheme of EAs
Parent selection Parents

Intialization
Recombination
(crossover)
Population
Mutation

Termination
Offspring
Survivor selection
Main EA components:
Population

• The candidate solutions (individuals) of the


problem
• Population is the basic unit of evolution, i.e.,
the
• population is evolving, not the individuals
• Selection operators act on population level
• Variation operators act on the individual
level
General scheme of EAs
Parent selection Parents

Intialization
Recombination
(crossover)
Population
Mutation

Termination
Offspring
Survivor selection
Main EA components:
Selection mechanisms
• Identify individuals
• to become parents
• to survive
• Pushes population toward higher fitness
• Parent selection is usually probabilistic
• high-quality solutions are more likely to be selected than low-
quality, but not guaranteed
• This stochastic nature can aid escape from local optima
General scheme of EAs
Parent selection Parents

Intialization
Recombination
(crossover)
Population
Mutation

Termination
Offspring
Survivor selection
Main EA components:
Variation operators
• Role: to generate new candidate solutions
• Usually divided into two types according to their arity
(number of inputs to the variation operator):
• Arity 1 : mutation operators
• Arity >1 : recombination operators
• Arity = 2 typically called crossover
• Arity > 2 is formally possible, seldom used in EC
Main EA components:
Mutation
• Role: cause small, random before 1 1 1 1 1 1 1
variance to a genotype
• Element of randomness
is essential and
differentiates it from other
unary heuristic operators after
1 1 1 0 1 1 1
Main EA components:
Recombination (1/2)
• Role: merges information from parents into offspring
• Choice of what information to merge is stochastic
• Hope is that some offspring are better by combining elements of
genotypes that lead to good traits
Main EA components:
Recombination (2/2)
Parents
cut cut
1 1 1 1 1 1 1 0 0 0 0 0 0 0

1 1 1 0 0 0 0 0 0 0 1 1 1 1

Offspring
Crossover and/or mutation?

•Crossover is explorative, it makes a big jump to an area


somewhere “in between” two (parent) areas
• Mutation is exploitative, it creates random small
diversions, thereby staying near (in the area of) the parent
General scheme of EAs
Parent selection Parents

Intialization
Recombination
(crossover)
Population
Mutation

Termination
Offspring
Survivor selection
Main EA components:
Initialisation / Termination
• Initialisation usually done at random
• Need to ensure even spread and mixture of possible allele values
• Can include existing solutions, or use problem-specific heuristics,
to “seed” the population
• Termination condition checked every generation
• Reaching some (known/hoped for) fitness
• Reaching some maximum allowed number of generations
• Reaching some minimum level of diversity
• Reaching some specified number of generations without fitness
improvement
Typical EA behavior: Stages
Stages in optimising on a 1- dimensional fitness landscape

Early stage:
quasi-random population distribution

Mid-stage:
population arranged around/on hills

Late stage:
population concentrated on high hills
Lecture 3
Evolutionary algorithms

4: Binary, integer and real- valued representations


Representation, Mutation, and
Recombination

• Role of representation and variation operators

• Most common representation of genomes:


• Binary
• Integer
• Real-Valued or Floating-Point
• Permutation
• Tree
Role of representation and variation operators

First stage of building an EA and most


difficult one: choose right
representation for the problem

Type of variation operators


needed depends on chosen
representation
Binary Representation

• One of the earliest representations


• Genotype consists of a string of binary
digits
Binary Representation:
Mutation
• Alter each gene independently with a probability pm
• pm is called the mutation rate
Binary Representation: 1- point crossover
• Choose a random point on the two
parents
• Split parents at this crossover point
• Create children by exchanging tails
Binary Representation: n- point crossover
• Choose n random crossover points
• Split along those points
• Glue parts, alternating between
parents
Binary Representation: Uniform crossover
• Assign 'heads' to one parent, 'tails' to the other
• Flip a coin for each gene of the first child
• Make an inverse copy of the gene for the second
child
• Breaks more “links” in the genome
Some problems naturally have integer variables,

• e.g. image processing parameters

Others take categorical values from a fixed set

Integer • e.g. {blue, green, yellow, pink}

Representation N-point / uniform crossover operators work

Extend bit-flipping mutation to make:

• “creep” i.e. more likely to move to similar value


• Adding a small (positive or negative) value to each gene
with probability p.
• Random resetting (esp. categorical variables)
• With probability pm a new value is chosen at random
Real-Valued or Floating-Point
Representation: Uniform Mutation

• General scheme of floating point mutations

• Uniform Mutation:

• Analogous to bit- flipping (binary) or random resetting


(integers)
Real- Valued or Floating- Point
Representation: Nonuniform Mutation
• Non-uniform mutations:
• Most common method is to add random deviate to each
variable separately, taken from N(0, σ) Gaussian distribution
and then curtail to range
• x’i = xi + N(0, σ)
• Standard deviation , mutation step size, controls amount of
change (2/3 of drawings will lie in range (- σ to + σ))
Lecture 3
Evolutionary algorithms

5: Permutation
Permutation Representations

• Useful in ordering/sequencing problems


• Task is (or can be solved by) arranging some objects in a certain order.
• Examples:
• production scheduling: important thing is which elements are
scheduled before others (order)
• Travelling Salesman Problem (TSP) : important thing is which
elements occur next to each other (adjacency)
• if there are n variables then the representation is as a list of n integers, each
of which occurs exactly once
Permutation Representations: Mutation

• Normal mutation operators lead to inadmissible solutions


• Mutating a single gene destroys the permutation
• Therefore must change at least two values
• Mutation probability now reflects the probability that some
operator is applied once to the whole string, rather than
individually in each position
Permutation Representations:
Swap mutation
• Pick two alleles at random and swap their positions
Permutation Representations:
Insert Mutation
• Pick two allele values at random
• Move the second to follow the first, shifting the rest along
to accommodate
• Note that this preserves most of the order and the
adjacency information
Permutation Representations:
Scramble mutation

• Pick a subset of genes at random


• Randomly rearrange the alleles in those positions
Permutation Representations:
Inversion mutation
• Pick two alleles at random and then invert the substring
between them.
• Preserves most adjacency information (only breaks two links)
but disruptive of order information
Permutation Representations:
Crossover operators
• “Normal” crossover operators will often lead to inadmissible
solutions

• Many specialised operators have been devised which focus


on combining order or adjacency information from the two
parents
Permutation Representations:
Conserving Adjacency
• Important for problems where adjacency between elements
decides quality (e.g. TSP)
Permutation Representations:
Conserving Order
• Important for problems where order of elements decide
performance (e.g. production scheduling)

Making breakfast:

1. Start brewing coffee


2. Toast bread
3. Apply butter
4. Add jam
5. Pour hot coffee
Permutation Representations:
Conserving Order
• Important for problems order of elements decide performance
(e.g. production scheduling)
• Now, [1,2,3,4,5] is a very different plan than [5,4,3,2,1]
• Order Crossover and Cycle Crossover are example operators
Sumamry

Powerful Optimization Tool: Inspired by Nature: Versatile Applications: Future Potential:


Evolutionary algorithms Mimicking biological From AI to engineering, EAs As technology evolves, EAs
offer a flexible and scalable evolution, these algorithms are widely used in areas will continue to play a key
approach to solving complex effectively search for where traditional methods role in solving emerging,
problems across diverse optimal solutions through struggle with complexity. sophisticated optimization
fields. natural selection challenges.
mechanisms.

You might also like