Genetic Algorith1worksheet

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Genetic algorithm Let the function will be f(x) = X1 + X2 X1X2, X will be in the range of (0, 100), ie both X1 and

d X2 is in the range of (0, 100). Step 1: Let find the binary value for 100 to determine the bits of chromosomes. 100 equivalent binary values is ____________________, therefore Chromosome = _______________________bits Step 2: generate the _________________ sequence of random nos If random number that exist above 0.5 is considered as bit 1 Random number which falls below 0.5 is considered as bit 0 From sequence of random numbers we generate Parent 1: _______________ Parent 2: _______________ Step 3: check the value with f(x) Let decimal value for parent1 and parent 2 are _________ and _____________. Then f(x) =_____________________, check for optimum. If it is not Step 4: generate one random number and check whether it is less than 0.9, if so do crossover or otherwise remain the parents same The resulting child strings created are expected to have better fitness values provided an appropriate (suitable) crossover site is selected. However, the suitable or appropriate crossover site is not known before hand. Hence the crossover site is usually chosen randomly. Since the random number generated is below 0.9, crossover occurs Random no generated is: ________________ Parent 1: _______________ Parent 2:_______________ Child 1:________________ Child 2:________________ Random nos (______________________________) Random nos (______________________________)

The suitable appropriate crossover site is ___________. Step 5: The crossover is the main operator by which new strings with better fitness values are created for the new generations. The mutation operator is applied to the new strings with a specific small mutation probability, pm (say 0.1). The mutation operator changes the binary digit (alleles value) 1 to 0 and vice versa. Since the generated random number is below 0.1 the mutation occurs, for Random no generated is _______________. Child 1: ____________________ (before mutation) Child 2: ____________________ (before mutation) New offspring 1: _____________________ New off spring 2:_____________________ Step 6: check feasibility by substituting in f(x). Let decimal value of new off spring __________ and ___________respectively then, F(x) = _____________________. Check for optimum, if not Repeat the procedure from Reproduction process until get the optimum value. Go to Step 2.

You might also like