Lecture2 genetic algorithmAlgorithm

Embed Size (px)

Citation preview

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    1/25

    Genetic Algorithms are good

    at taking large, potentially

    huge search spaces and

    navigating them, lookingfor optimal combinations

    of things, solutions you

    might not otherwise find in

    a lifetime.

    - Salvatore Mangano

    Computer Design, May 1995

    Genetic Algorithms:

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    2/25

    The Genetic Algorithm

    Provide efficient, effective techniques for

    optimization and machine learning

    applications

    Widely-used today in business, scientific andengineering circles

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    3/25

    Introduction to Evolutionary Computation

    Evolutionary Computation is the field of study devoted to the

    design, development, and analysis is problem solvers based onnatural selection (simulated evolution).

    Evolution has proven to be a powerful search process.

    Evolutionary Computation has been successfully applied to a

    wide range of problems including:

    Aircraft Design,

    Routing in Communications Networks,

    Tracking Windshear,

    Game Playing (Checkers)

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    4/25

    Main idea

    Take a population of candidate solutions to a

    given problem

    Use operators inspired by the mechanismsof natural genetic variation

    Apply selective pressure toward certain

    properties

    Evolve a more fit solution

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    5/25

    Evolutionary terminology

    Abstractions imported from biology

    Chromosomes, Genes, Alleles

    Fitness, Selection

    Crossover, Mutation

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    6/25

    GA terminology

    In the spirit but not the letter of biology

    GA chromosomes are strings of genes

    Each gene has a number of alleles; i.e., settings

    Each chromosome is an encoding of a solution

    to a problem

    A population of such chromosomes is operated

    on by a GA

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    7/25

    Encoding

    A data structure for representing candidate

    solutions

    Often takes the form of a bit string

    Usually has internal structure; i.e., different parts

    of the string represent different aspects of the

    solution)

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    8/25

    Fitness

    A measure of the goodness of the organism

    Expressed as the probability that the organism will live

    another cycle (generation)

    Basis for the natural selection simulation

    Organisms are selected to mate with probabilities

    proportional to their fitness

    Probabilistically better solutions have a better chance of

    conferring their building blocks to the next generation (cycle)

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    9/25

    Simple Genetic Algorithm{

    initialize population;

    evaluate population;

    while TerminationCriteriaNotSatisfied{

    select parents for reproduction;

    perform recombination and mutation;

    evaluate population;}

    }

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    10/25

    Candidate Solutions CS1. In an Evolutionary Computation, a population of candidate

    solutions (CSs) is randomly generated.

    2. Each of the CSs is evaluated and assigned a fitness based on a

    user specified evaluation function.

    1. The evaluation function is used to determine the

    goodness of a CS.

    3. A number of individuals are then selected to be parents based

    on their fitness.

    4. The Select_Parents method must be one that balances the

    urge for selecting the best performing CSs with the need for

    population diversity.

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    11/25

    Parent selection

    Chance to be selected as parent proportional to

    fitness

    Roulette wheel

    To avoid problems with fitness function

    Tournament

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    12/25

    Tournament Binary tournament

    Two individuals are randomly chosen; the fitter of the twois selected as a parent

    Probabilistic binary tournament

    Two individuals are randomly chosen; with a chancep,

    0.5

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    13/25

    The GA Cycle of Reproduction

    reproduction

    population evaluation

    modification

    discard

    deleted

    members

    parents

    children

    modified

    children

    evaluated children

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    14/25

    Parents and Generations

    1. The selected parents are allowed to create a set of offspring

    which are evaluated and assigned a fitness using the same

    evaluation function defined by the user.

    2. Finally, a decision must be made as to which individuals of

    the current population and the offspring population should be

    allowed to survive.

    1. Typically, in EC , this is done to guarantee that the

    population size remains constant.

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    15/25

    Population

    Chromosomes could be:

    Bit strings (0101 ... 1100) Real numbers (43.2 -33.1 ... 0.0 89.2)

    Permutations of element (E11 E3 E7 ... E1 E15)

    Lists of rules (R1 R2 R3 ... R22 R23)

    Program elements (genetic programming) ... any data structure ...

    population

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    16/25

    Reproduction

    reproduction

    population

    parents

    children

    Parents are selected at random with

    selection chances biased in relation tochromosome evaluations.

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    17/25

    Crossover: Recombination

    P1 (0 1 1 0 1 0 0 0) (0 1 0 0 1 0 0 0) C1

    P2 (1 1 0 1 1 0 1 0) (1 1 1 1 1 0 1 0) C2

    Crossover is a critical feature of genetic

    algorithms:

    It greatly accelerates search early in evolution of a

    population

    It leads to effective combination of schemata(subsolutions on different chromosomes)

    *

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    18/25

    Mutation: Local Modification

    Before: (1 0 1 1 0 1 1 0)

    After: (0 1 1 0 0 1 1 0)

    Before: (1.38 -69.4 326.44 0.1)

    After: (1.38 -67.5 326.44 0.1)

    Causes movement in the search space(local or global)

    Restores lost information to the population

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    19/25

    Evaluation

    The evaluator decodes a chromosome and assigns

    it a fitness measure

    The evaluator is the only link between a classical

    GA and the problem it is solving

    evaluation

    evaluated

    children

    modified

    children

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    20/25

    Fitness Function

    Purpose Parent selection

    Measure for convergence

    Steady state: Selection of individuals to die

    Should reflect the value of the chromosome in some real way

    Next to coding the most critical part of a GA

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    21/25

    Selecting and Stopping Once a decision is made the survivors comprise the next

    generation (Pop(t+1)).

    This process of selecting parents based on their fitness,allowing them to create offspring, and replacing weaker

    members of the population is repeated for a user specifiednumber of cycles.

    Stopping conditions for evolutionary search could be:

    The discovery of an optimal or near optimal solution

    Convergence on a single solution or set of similar solutions,

    When the EC detects the problem has no feasible solution,

    After a user-specified threshold has been reached, or

    After a maximum number of cycles.

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    22/25

    Issues for GA Practitioners

    Choosing basic implementation issues:

    representation

    population size, mutation rate, ...

    selection, deletion policies

    crossover, mutation operators

    Termination Criteria

    Performance, scalability

    Solution is only as good as the evaluation function(often hardest part)

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    23/25

    Benefits of Genetic Algorithms

    Concept is easy to understand

    Modular, separate from application

    Supports multi-objective optimization

    Good for noisy environments Always an answer; answer gets better with time

    Inherently parallel; easily distributed

    Many ways to speed up and improve a GA-based

    application as knowledge about problem domain isgained

    Easy to exploit previous or alternate solutions

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    24/25

    When to Use a GA

    Alternate solutions are too slow or overly complicated

    Need an exploratory tool to examine new approaches

    Problem is similar to one that has already been

    successfully solved by using a GA

    Benefits of the GA technology meet key problem

    requirements

  • 7/29/2019 Lecture2 genetic algorithmAlgorithm

    25/25

    Some GA Application Types

    Domain Application TypesControl gas pipeline, pole balancing, missile evasion, pursuit

    Design semiconductor layout, aircraft design, keyboardconfiguration, communication networks

    Scheduling manufacturing, facility scheduling, resource allocation

    Robotics trajectory planning

    Machine Learning designing neural networks, improving classificationalgorithms, classifier systems

    Signal Processing filter design

    Game Playing poker, checkers, prisoners dilemma

    Combinatorial

    Optimization

    set covering, travelling salesman, routing, bin packing,graph colouring and partitioning