Download - GA_for_ME_III

Transcript

ECONOMIC LOAD DISPATCH USING GENETIC ALGORITHMS

GENETIC ALGORITHMS FOR ENGINEERING OPTIMIZATIONH.D. MEHTAASSO. PROF (ELECT. ENGG)L.D. COLLEGE OF ENGG.AHMEDABAD

WHAT IS OPTIMIZATION ?Optimization is the process of making something betterAn engineer or scientist comes up with a new idea and optimization improves on that ideaOptimization consists in trying variations on an initial concept and using the information gained to improve on the ideaA computer is the perfect tool for optimization if the data can be input in electronic format

OptimizationcontdFeed the computer some data and out comes the solutionIs this the only solution? Often times notIs it the best solution? Thats a tough questionOptimization is the math tool that we rely on to get these answers

OptimizationcontdOur lives confront us with many opportunities for optimizationWhat time do we get up in the morning so that we maximize the amount of sleep yet still make it to work on time?What is the best route to work?Which project do we tackle first?Optimization is the process of adjusting the inputs to or characteristics of a device, mathematical process, or experiment to find the minimum or maximum output or resultBASICS OF GENETIC ALGORITHMSGenetic algorithms are computerized search and optimization algorithms based on the mechanics of natural genetics and natural selectionGAs are based on Darwins theory of survival of fittest.Professor John Holland of the University of Michigan, envisaged the concept of these algorithms.Most of GA studies are available through few books (Davis, 1991; Goldberg, 1989; Holland, 1975; Michalewicz, 1992) and through number of conference proceedings (Belew and Booker, 1991; Forrest, 1993; Grefenstette, 1985, 1987; Rawlings, 1991; Schaffer, 1989, Whitely, 1993)The basic elements of natural geneticsreproduction, crossover, and mutationare used in the genetic search procedure.

November 26, 20145DIFFERENCE BETWEEN GA AND TRADITIONAL OPTIMIZATION METHODSA population of points (trial design vectors) is used for starting the procedure instead of a single design point. If the number of design variables is n, usually the size of the population is taken as 2n to 4n. Since several points are used as candidate solutions, GAs are less likely to get trapped at a local optimum.GAs use only values of objective functions. The derivatives are not used in the search procedure.In GAs the design variables are represented as string of binary variables that correspond to chromosomes in natural geneticsThe string length can be varied to achieve any desired resolution.The objective function value corresponding to a design vector plays the role of fitness in natural genetics.

November 26, 20146DIFFERENCE BETWEEN GA AND TRADITIONAL OPTIMIZATION METHODSIn every new generation, a new set of strings is produced by using randomized parents selection and cross over from the old generation (old set of strings). Although randomized, GAs are not simple random search techniques. They efficiently explore new combinations with the available knowledge to find a new generation with better fitness or objective function value.

November 26, 20147Key terms Individual - Any possible solution Population - Group of all individuals Search Space - All possible solutions to the problem Chromosome - Blueprint for an individual Trait - Possible aspect (features) of an individualAllele - Possible settings of trait (black, blond, etc.)Locus - The position of a gene on the chromosome Genome - Collection of all chromosomes for an individual

Chromosome, Genes andGenomes

Genotype and PhenotypeGenotype: Particular set of genes in a genome

Phenotype: Physical characteristic of the genotype (smart, beautiful, healthy, etc.)

Genotype and Phenotype

REPRESENTATION OF DESIGN VARIABLESIn GAs the design variables are represented as string of binary variables, 0 and 1. For example if a design variable xi is represented by a string of length four such as 0101, then its decimal equivalent will be 120 + 021 + 122 + 023 = 5If each design variable xi , i = 1,2,..n is coded in a string of length q a design vector is represented using of string of total length nq. The length of the string is usually determined according to the desired solution accuracy.fact the number of binary digits needed to represent a continuous variable in steps (accuracy) of x, q can be computed from the relation2q + 1November 26, 201412

REPRESENTATION OF DESIGN VARIABLESIf a continuous variable x with bounds 1 and 5 is to be represented with a accuracy of 0.01, we need to use a binary representation with q digits where 2q + 1 = 401 or q =9

Conversely, if a variable x (whose bounds are given by xu and xl) is represented by a string of q binary numbers, its decimal value can be computed as xi = xil + decoded value of string si

November 26, 201413

FITNESS FUNCTIONAs GAs mimic the survival of the fittest principle of nature to make a search process, they are naturally suitable for maximization problems. Minimization problems are usually transformed into maximization problems by some suitable transformation. In general, a fitness function F(x) is first derived from objective function and is used in successive genetic operationsFor minimization problems, the fitness function is an equivalent maximization problem chosen such that the optimum point remains unchanged. The following fitness function is often usedF(x) = 1/(1+ f(x))The fitness function value of a string is known as strings fitness.

November 26, 201414GA OPERATIONThe operation of GA begins with a population of random strings representing design variables or decision variablesThereafter, each string is evaluated to find the fitness value. The population is then operated by three main operators reproduction, crossover and mutation to create new population of points. The new population is further evaluated and tested for terminationIf the termination criterion is not met, the population is iteratively operated by above three operators and evaluated. This procedure is continued until the termination criterion is metOne cycle of these generations and the subsequent evaluation procedure is known as generation in GAs terminologyNovember 26, 201415GA OPERATORS(1) REPRODUCTION (2) CROSSOVER (3) MUTATIONREPRODUCTIONReproduction is the first operation applied to the population to select good strings (designs) of the population to form a mating pool. The reproduction operator is also called the selection operator because it selects good strings of the populationThe reproduction operator is used to pick above-average strings from the current population and insert their multiple copies in the mating pool based on a probabilistic procedureIf 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 bypi = .. 1.1

November 26, 201416

REPRODUCTION..CONTDThe implementation of the selection process given by Equation 1.1 can be understood by imagining a roulette wheel with its circumference divided into segments, one for each string of the population, with the segment lengths proportional to the fitness of the stringsBy spinning the roulette wheel n times (n being the population size) and selecting, each time, the string chosen by the roulette-wheel pointer, we obtain a mating pool of size n.

November 26, 201417

REPRODUCTION..CONTDIn previous fig., the population size is assumed to be 6 with fitness values of strings 1,2,3,4,5 and 6 given by 12, 4, 16, 8, 36 and 24 respectively. Since the fifth string has the highest fitness value, it is expected to be selected most of the time (36% of the time, probabilistically), when the roulette wheel is spun n times

November 26, 201418String NoFitness valueProbability of selectionCumulative Probability Range of Cum. Prob1120.120.120.00-0.12240.040.160.12-0.163160.160.320.16-0.32480.080.400.32-0.405360.360.760.40-0.766240.241.000.76-1.00REPRODUCTION..CONTDSuppose the random numbers generated are given in table below, then the strings which are copied to the mating pool are given below

November 26, 201419Random Number Generated0.410.100.420.800.670.390.630.530.860.880.750.55String Number to be copied to mating pool515654556655SRWSSolution, iFipiPipi N

125.00.250.251.2525.00.050.300.25340.00.400.702.00410.00.100.800.50520.00.201.001.00EXAMPLELet us consider a simple can design problemA cylindrical can is considered to have only two parameters- diameter d and height hAssume that can needs to have a volume of at least 300 mlMinimize f(d,h) = c ( d2/2 + dh)subject to g1 (d,h) = d2h/4 300Variable boundsdmin d dmaxhmin h hmax

EXAMPLE.contdSuppose (d,h) = (8,10)Chromosome = 01000 01010Natural chromosomes are made up of many genes, each of which can take many different allele values (such as, the gene responsible for the eye colour in a persons chromosomes may be expressed as black, whereas it could have been blue or some other colour)To see how these 10 genes control the phenotype (the shape) of the can, let us investigate the leftmost bit (gene) of the diameter (d) parameter

EXAMPLE.contdA value of 0 at this bit allows the can to have diameter values in the range [0, 15], whereas the value 1 allows the can to have diameter values in the range [16,31]

Clearly this bit (or gene) is responsible for dictating the slimness of the can. If the allele value 0 is expressed, the can is slim, while if the value 1 is expressed the can is fat.TOURNAMENT SELECTIONIn tournament selection, tournaments are played between two solutions and the better solution is placed in the mating pool.Two other solutions are picked again and another slot in mating pool is filled with the better solution.If carried out systematically, each solution can be made to participate in exactly two tournaments.The best solution will win both times, thereby making two copies of it in the mating poolTOURNAMENT SELECTIONcontdUsing a similar argument, the worst solution will lose in both tournaments and will be eliminated from the populationIn this way, any solution in a population will have zero, one or two copies in the new population.It has been shown that tournament selection has better or equivalent convergence as compared to any other reproduction operator that exists in GA literature TOURNAMENT SELECTIONcontd

TOURNAMENT SELECTIONcontd

STOCHASTIC UNIVERSAL SELECTIONIn SUS only one random number r is chosen for the whole selection processSince N different solutions have to be chosen, a set of N equi-spaced numbers is created using the equationR = { r, r+1/N, r+2/N, ..r+(N-1)/N}Thereafter, a solution corresponding to each member of R is chosen from the cumulative probability values as before

STOCHASTIC UNIVERSAL SELECTION

CROSSOVERAfter reproduction the crossover operator is implemented. The purpose of crossover is to create new strings by exchanging information among strings of the mating pool. In most crossover operators, two individual strings (designs) are picked (or selected) at random from the mating pool generated by the reproduction operator and some portions of the strings are exchanged between the strings.In the commonly used process, known as a single-point crossover operator, a crossover site is selected at random along the string length, and the binary digits (alleles) lying on the right side of the crossover site are swapped (exchanged) between the two stringsThe two strings selected for participation in the crossover operators are known as parent strings and the strings generated by the crossover operator are known as child strings

November 26, 201430CROSSOVER.CONTDFor example, if two design vectors (parents), each with a string length of 10, are given by(Parent 1) = {0 1 0 | 1 0 1 1 0 1 0 0 1}(Parent 2) = {1 1 0 | 0 0 1 0 1 1 1 0 1}

The result of crossover, when the crossover site is at 3 is given by(Child 1) = {0 1 0 | 0 0 1 0 1 1 1 0 1}(Child 2) = {1 1 0 | 1 0 1 1 0 1 0 0 1}

Since the crossover operator combines substrings from parent strings (which have good fitness values), the resulting child strings created are expected to have better fitness values provided an appropriate (suitable) crossover site is selected.

The child strings generated using a random crossover site may or may not be as good or better than their parent strings in terms of their fitness values.

November 26, 201431CROSSOVER.CONTDIf the child strings created are worse than their parent strings, it should not be of much concern to the success of the GAs because the bad child strings will not survive very long as they are less likely to be selected in the next reproduction stage (because of the survival-of-the-fittest strategy used)

The effect of crossover may be useful or detrimental. Hence it is desirable not to use all the strings of the mating pool in crossover but to preserve some of the good strings of the mating pool as part of the population in the next generation.

If pc is the crossover probability 100 pc percent of the strings in the mating pool will be used in the crossover operator while 100 (1 pc) percent of the strings will be retained as they are in the new generation (of population)

November 26, 201432n-point crossoverChoose n random crossover pointsSplit along those pointsGlue parts, alternating between parents

Uniform crossoverAssign 'heads' to one parent, 'tails' to the otherFlip a coin for each gene of the first childMake an inverse copy of the gene for the second child

MUTATIONThe mutation operator is applied to the new strings with a specific small mutation probability, pm

The mutation operator changes the binary digit (alleles value) 1 to 0 and vice versa. In the single-point mutation, a mutation site is selected at random along the string length and the binary digit at that site is then changed from 1 to 0 or 0 to 1 with a probability of pm

A random number between 0 and 1 is generated/chosen. If the random number is smaller than pm, then the binary digit is changed. Otherwise, the binary digit is not changed

November 26, 201435MUTATION.CONTDAs an example consider the following population of size n = 5 with a string length 101 0 0 0 1 0 0 0 1 11 0 1 1 1 1 0 1 0 0 1 1 0 0 0 0 1 1 0 11 0 1 1 0 1 0 0 1 01 1 1 0 0 0 1 0 0 1Here all the five strings have a 1 in the position of the first bit. The true optimum solution of the problem requires a 0 as the first bit. The required 0 cannot be created by either the reproduction or the crossover operators. However, when the mutation operator is used, the binary number will be changed from 1 to 0 in the location of the first bit with a probability of npm.

November 26, 201436 START 1. Create initial random population2. Set Max. Generation counter 3. Set Generation counter = 1

Evaluate fitness of each string in populationCreate mating pool and find the number of copies of each string to be copied to mating pool using any selection methodPerform crossover and mutationGenerate new populationIncrement gen count by one

Is Generation counter < Max. gen.? STOP YESNONovember 26, 201437AN EXAMPLE BASED ON GAThe objective is to minimize the functionf(x1,x2) = (x12 + x2 11)2 + (x1 + x22 -7)2in the interval 0 x1,x2 6Population size =20String length = 10Accuracy = (6-0)/(210 1) = 0.006Chromosome length = 20

Examplecontd

Example.contdAverage fitness of population = 0.008Maximum fitness = 0.024Expected count = String fitness/Average fitness(For first string , expected count = 0.001/0.008 = 0.13)Probability of selection = Expected count/pop size(For first string , selection probab = 0.13/20 = 0.007 )The inferior points have been probabilistically eliminated from further consideration. Notice that not all selected points are better than rejected points For e.g. 14th individual (fitness value 0.002) is selected but the 16th individual (fitness value 0.005) is not selected

Example.contdThe average fitness of the new population is calculated to be 0.015, a remarkable improvement from that in the initial population.The best point in this population is found to have a fitness equal to 0.050 which is also better than the initial populationThis continues till the maximum allowable generation is reached or some other termination criteria is met.Example.contd

Pop best value v/s no. of generations

Why do GAs work?In this section we take an in-depth look at the working of the standard genetic algorithm, explaining why GAs constitute an effective search procedure

For simplicity we discuss binary string representation of individuals

Notation (schema){0,1,#} is the symbol alphabet, where # is a special wild card symbolA schema is a template consisting of a string composed of these three symbolsExample: the schema [01#1#] matches the strings: [01010], [01011], [01110] and [01111]

Notation (order)The order of the schema S (denoted by o(S)) is the number of fixed positions (0 or 1) presented in the schema

Example: for H1 = [01#1#], o(H1) = 3 for H2 = [##1#1010], o(H2) = 5

The order of a schema is useful to calculate survival probability of the schema for mutation

Notation (defining length)The defining length of schema S (denoted by (S)) is the distance between the first and last fixed positions in it

Example:for S1 = [01#1#], (H1) = 4 1 = 3, for S2 = [##1#1010], (H2) = 8 3 = 5

The defining length of a schema is useful to calculate survival probability of the schema for crossovers

Growth of SchemaThe growth of schema in one iteration of GA is goven by the equation

m (H,t+1) m (H,t) ( f(H)/f avg(t) ) [1 - pc((H)/(l 1)) pmo(H)]

ExampleLet us apply GA for one cycle to a numerical maximization problemMaximize :sin(x)Variable bounds :0xWe will use 5 bit strings to represent variable x in the range of [0, ], so that string (00000) represents x=0 and string (11111) represents x= We will use pc = 1 and pm = 0 for simplicity

ExampleAverage favg = 0.569StringDVxf(x)fi/favgACMating pool0100190.9120.7911.3910100110100202.0270.8981.582101000000110.1010.1010.1801010011010262.6350.4850.85111010ExamplecontdAverage favg = 0.710Mating poolCS pointString after CSDVxf(x)0100130100080.8110.72510100310101212.1280.84910100210010181.8240.96811010211100282.8380.299ExamplecontdLet us consider schema H1 = (1 0 * * * ) and schema H2 = (0 0 * * * )For schema H1 m (H,t+1) (1) ( 0.898/0.569 ) [1 1.0/(5 1)) 0.0(2)] = 1.184

The above calculation suggests that the number of strings representing schema H1 must increaseFor schema H2 the estimated number of copies using the above equation is m (H,t+1) 0.133Building blocks of GAThe schema H1 for the above example has only two defined positions (the first two bits) and both defined bits are tightly spaced (very close to each other) and contain the near possible solutionThe schemata that are short, low order and above average are known as building blocks.While GA operators are applied on a population of strings, a number of such building blocks in various parts along the string get emphasized, such as H1.Building blocks of GANote that H2 is short and low order, it is not an above average schema. Thus H2 is not a building block.This is how GAs can emphasize different short, low order and above average schemata in the population.Once adequate number of building blocks are present in a GA population, they get combined together due to action of GA operators to form bigger and better building blocks. This process finally leads a GA to find the optimal solution.This hypothesis is known as Building Block Hypothesis


Top Related