Instructions
Design the layout of your genetic algorithm. Genetic algorithms work for problems where the solution to the problem consists of optimizing the values of a string of numbers. A population of strings are evaluated and manipulated in ways suggested by evolution until one of the population is a string that is the solution to a specific problem. The layout of the algorithm consists of designing the layout of the strings, designing algorithms for manipulating the population and evaluating the strings in each generation.
Start with a random population: a large number of strings where all of the numbers in all the strings were chosen at random. Evaluate all of the strings and discard the strings with the lowest evaluations. Apply two evolutionary techniques to the high performers: mutation and crossover. Mutation consists of selecting a small number of places on a small number of strings and changing the number a little either up or down. Crossover consists of lining up two strings, picking a random "crossover point' and switching the heads and tails at the crossover point. The successes from the last generation plus the newly created strings make up the new population. Each generation has the same number of strings in the population.
Run this algorithm for several generations and look at the best string. If it is not good enough, you need to change some of the parameters and run the algorithm again. One of the most significant changes you can make is to change the way the strings are made. For example, suppose you are trying to design the interior of the combustion chamber of a jet engine. The strings may consist of 20 measurements made on the inside of the design of the engine. Starting with different measurements is the change that is most likely to give you a better answer.
The important parameters to tweak when optimizing your algorithm are mutation rate, population size, the number of values on a string and the positions of the values on the string -- whether they are in the middle or on the ends.