GA and SA Part of Unit4

download GA and SA Part of Unit4

of 19

Transcript of GA and SA Part of Unit4

  • 7/29/2019 GA and SA Part of Unit4

    1/19

    Genetic Algorithm

  • 7/29/2019 GA and SA Part of Unit4

    2/19

    What is a genetic algorithm?

    GA part of the broadersoft computing(aka "computationalintelligence") paradigm known as evolutionary computation

    First introduced by Holland (1975)

    Inspired by possibility of problem solving through a process ofevolution

  • 7/29/2019 GA and SA Part of Unit4

    3/19

    What is a GA? (contd) GA mimics biological evolution to generate better solutions from

    existing solutions through survival of the fittest

    crossbreeding and

    mutation

  • 7/29/2019 GA and SA Part of Unit4

    4/19

    What is a GA? (contd)

    A GA is capable of finding solutions for many problems for which

    no usable algorithmic solutions exist

    GA methodology particularly suited foroptimization

    Optimization searches a solution space consisting of a large number

    of possible solutions

    GA reduces the search space through evolution of solutions,

    conceived as individuals in a population

    In nature, evolution operates on populations of organisms, ensuringby natural selection that characteristics that serve the members welltend to be passed on to the next generation, while those that dont dieout

  • 7/29/2019 GA and SA Part of Unit4

    5/19

    Evolution as Optimisation

    Evolution can be seen as a process leading to the optimisation of a

    populations ability to survive and thus reproduce in a specificenvironment.

    Evolutionary fitness - the measure of the ability to respond

    adequately to the environment, is the quantity that is actuallyoptimised in natural life

    Consider a normal population of rabbits. Some rabbits are naturally

    faster than others. Any characteristic has a range of variation that isdue to i) sexual reproduction and ii) mutation

  • 7/29/2019 GA and SA Part of Unit4

    6/19

    How GAs work

    A population of candidate solutions - mathematicalrepresentations - is repeatedly altered until an optimal

    solution is found

    The GA evolutionary cycle

    Starts with a randomly generated initial population of solutions(1st generation)

    Selects a population of better solutions (next generation) byusing a measure of 'goodness' (a fitness evaluation function)

    Alters new generation population through crossbreeding andmutation

    Processes of selection (step 2) and alteration (step 3) lead to apopulation with a higher proportion of better solutions

  • 7/29/2019 GA and SA Part of Unit4

    7/19

    How GAs work (contd)

    The GA evolutionary cycle continues until an acceptablesolution is found in the current population,

    or

    some control parameter such as the maximum number ofgenerations is exceeded

  • 7/29/2019 GA and SA Part of Unit4

    8/19

    How solutions are represented

    A series of genes, known as a chromosome, represents one possiblesolution

    Eachgene in the chromosome represents one component of thesolution pattern

    Each gene can have one of a number of possible values known asalleles

    The process of converting a solution from its original form into achromosome is known as coding

    The most common form of representing a solution as achromosome is a string of binary digits (aka a binary vector) eg

    1010110101001Each bit in this string is a gene with two alleles: 0 and 1

    Other forms of representation are also used, eg, integer vectors

    Solution bit strings are decodedto enable them to be evaluatedusing a fitness measure

  • 7/29/2019 GA and SA Part of Unit4

    9/19

    If each design variable xi , i = 1, 2, . . . , n is coded in a string of length

    q, a design vector is represented using a string of total length nq.

    For example, (x1 = 18, x2 = 3, x3 = 1, x4 = 4):

    How solutions are represented (contd..)

    In general, if a binary number is given by bqbq1 b2b1b0,where bk= 0

    or 1, k = 0, 1, 2, . . . , q, then its equivalent decimal number y (integer) is

    given by

    If a variable x bounds are given by x(l) and x(u), its decimal value can be

    computed as

  • 7/29/2019 GA and SA Part of Unit4

    10/19

    GA Selection or Reproduction Selection in GA based on a process analogous to that of biological

    evolutionOnly the fittest survive and contribute to the gene pool of the nextgeneration

    Fitness proportional selection

    Each chromosomes likelihood of being selected is proportional toitsfitness value.

    Solutions failing selection are bad, and are discarded Crossover by splicing two chromosomes at a crossover point and

    swapping the spliced parts

    A better chromosome may be created by combining genes with

    good characteristics from one chromosome with some good genesin the other chromosome

    Crossover carried out with a probabilitytypically 0.7

    Chromosomes not crossed over are cloned

  • 7/29/2019 GA and SA Part of Unit4

    11/19

    GA Selection or Reproduction

    if Fi denotes the fitness of the ith string in the population of size n, the

    probability for selecting the ith string for the mating pool (pi ) is

    given by

    Roulette-wheel selection scheme

  • 7/29/2019 GA and SA Part of Unit4

    12/19

    Crossover and Mutation

    Mutation

    A random adjustment in the genetic composition Can be useful for introducing new characteristics in a population

    May be counterproductive

    Probability kept low: typically 0.001 to 0.01

  • 7/29/2019 GA and SA Part of Unit4

    13/19

    Genetic Algorithm process

    1. Represent the solution as a chromosome of fixed length, choose sizeof population N, crossover probability pc and mutation probability

    pm.

    2. Define a fitness functionffor measuring fitness of chromosomes.

    3. Create an initial solution population randomly of size N:x1, x2, , xN

    4. Use the fitness functionf to evaluate the fitness value of eachsolution in the current generation:

    f(x1),f(x2), ,f(xN)

    5. Select good solutions based on fitness value. Discard rest of thesolutions.

    6. If acceptable solution (s) found in the current generation ormaximum number of generations is exceeded then stop.

    7. Alter the solution population using crossover and mutation to create anew generation of solutions with population size N.

    8. Go to step 4

  • 7/29/2019 GA and SA Part of Unit4

    14/19

    Genetic Algorithm process

  • 7/29/2019 GA and SA Part of Unit4

    15/19

    Advantages of GA systems

    Useful when no algorithms or heuristics are available for solving aproblem

    No formulation of the solution is required - only "recognition" of agood solution

    A GA system can be built as long as a solution representation and anevaluation scheme can be worked out

    So minimal domain expert access is required

    GA can act as an alternative to - Expert Systems if

    number of rules is too large or

    the nature of the knowledge-base too dynamic

    Traditional optimization techniques if constraints and objective functions are non-linearand/ordiscontinuous

  • 7/29/2019 GA and SA Part of Unit4

    16/19

    Advantages of GA systems GA does not guarantee optimal solutions, but produce near optimal

    solutions which are likely to be very good

    Solution time with GA is highly predictableDetermined by Size of the population

    Time taken to decode and evaluate a solution and

    Number of generations of population

    GA uses simple operations to solve problems that arecomputationally prohibitive otherwise

    Because of simplicity, GA software are Reasonably sized and self-contained

    Easier to embed them as a module in another system

    GA can also aid in developing intelligent business systems that useother methodologies, eg, Building the rule base of an expert system

    Finding optimal neural networks

  • 7/29/2019 GA and SA Part of Unit4

    17/19

    Some issues related to GA based systems Level of explainability

    Scalability

    Data requirements Local maxima Local maxima are regions that hold good solutions relative to regions around

    them, but which do not necessarily contain the best overall solutions

    The region(s) that contain the best solutions are calledglobal maxima

    GAs are less prone to being trapped in local maxima because of the use ofmutation and crossover

    Premature convergence A GA is said to have converged prematurely if it explores a local maximum

    extensively

    Most significant factor leading to such convergence is a mutation rate which is

    too slow Mutation interference is an effect opposite to that of premature convergence

  • 7/29/2019 GA and SA Part of Unit4

    18/19

    Simulated Annealing

    Simulates the process of slow cooling of molten metal to achieve

    the absolute minimum energy state. The temperature needs to be

    reduced at a slow rate.

    The cooling phenomenon is simulated by controlling a

    temperature like parameter introduced with the concept of the

    Boltzmann probability distribution.

    A system in thermal equilibrium at a temperature T has its energy

    distributed probabilistically according to

    where k = Boltzmann constant

  • 7/29/2019 GA and SA Part of Unit4

    19/19

    Algorithm

    Step 1: Initial point and termination criterion

    set T = high temperature and number of iterations at T

    Step2: Calculate a neighbouring point in the vicinity of current point.Step3: IfE = E(Xi+1)- E(Xi)< 0 and go to next iteration.

    Else use Metropolis algorithm to accept the current point

    Create a random number r in the range of (0,1).

    If r exp (- E /T), accept the point according to Metropolisand go to next iteration.

    Else go to step 2.

    Step4: If number of iterations reached maximum, terminate the process

    at T.Step5: If T is small, terminate.

    Else lower T according to a cooling schedule.

    New temperature = 0.5 *T , go to step 2.