Question: Write a program to implement a GA. You can use libraries in a language of your choice, or you can use the example code we
Write a program to implement a GA. You can use libraries in a language of your choice, or you can use the example code we have developed or you can write your own code.
The problem is quite simple: it tries to find a bit string of alternating two ones and two zeroes (e.g. 11001100...). The string must start with two 1s and two 0s should become after that. This pattern should be repeated for the whole string.
Run your GA with the following parameters: Representation: Bitstring (L=24) Initialization: random Parent Selection: fitness proportionate, implemented via roulette wheel Recombination: one point crossover with probability pc= 0.7 Mutation: bit-flip with probability pm= 1 / L Replacement: strict generational (no elitism) Population size: 100 Termination criterion: 1000 generations or optimum found (whichever first)
Do the following: 1. After every generation, find the best, worst and mean fitness of the population, plot these on a graph with time as x-axis (For one run only). 2. Do 10 runs and find the mean and standard deviation of the time taken to find the optimum, and the average number of generations to find the optimum. 3. Repeat the previous two steps for L = 100. How do your results change? Comment. 4. Use tournament selection with size 2 instead of roulette wheel for parent selection and repeat steps 1-2 for L = 100. Combine your resulting graphs and tables into a single document and upload it.
Write a program to implement a GA. You can use libraries in a language of your choice, or you can use the example code we have developed or you can write your own code. The problem is quite simple: it tries to find a bit string of alternating two ones and two zeroes (e.g. 11001100...). The string must start with two 1s and two Os should become after that. This pattern should be repeated for the whole string. Run your GA with the following parameters: Representation: Bitstring (L=24) Initialization: random Parent Selection: fitness proportionate, implemented via roulette wheel Recombination: one point crossover with probability pc= 0.7 Mutation: bit-flip with probability pm= 1/L Replacement: strict generational (no elitism) Population size: 100 Termination criterion: 1000 generations or optimum found (whichever first) Do the following: 1. After every generation, find the best, worst and mean fitness of the population, plot these on a graph with time as x-axis (For one run only). 2. Do 10 runs and find the mean and standard deviation of the time taken to find the optimum, and the average number of generations to find the optimum. 3. Repeat the previous two steps for L = 100. How do your results change? Comment 4. Use tournament selection with size 2 instead of roulette wheel for parent selection and repeat steps 1-2 for L = 100. Combine your resulting graphs and tables into a single document and upload it. Write a program to implement a GA. You can use libraries in a language of your choice, or you can use the example code we have developed or you can write your own code. The problem is quite simple: it tries to find a bit string of alternating two ones and two zeroes (e.g. 11001100...). The string must start with two 1s and two Os should become after that. This pattern should be repeated for the whole string. Run your GA with the following parameters: Representation: Bitstring (L=24) Initialization: random Parent Selection: fitness proportionate, implemented via roulette wheel Recombination: one point crossover with probability pc= 0.7 Mutation: bit-flip with probability pm= 1/L Replacement: strict generational (no elitism) Population size: 100 Termination criterion: 1000 generations or optimum found (whichever first) Do the following: 1. After every generation, find the best, worst and mean fitness of the population, plot these on a graph with time as x-axis (For one run only). 2. Do 10 runs and find the mean and standard deviation of the time taken to find the optimum, and the average number of generations to find the optimum. 3. Repeat the previous two steps for L = 100. How do your results change? Comment 4. Use tournament selection with size 2 instead of roulette wheel for parent selection and repeat steps 1-2 for L = 100. Combine your resulting graphs and tables into a single document and upload it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
