The following is in relation to Practical Genetic Algorithms, and is intended to give you a real life application
of Genetic Algorithms.
Read the problem below, and formulate an approach to solving this problem by defining the fitness function, mutation operation and crossover operation. Make assumptions where necessary and justify your answer.
This example uses a continuous GA to break a secret code. A message consisting of letters and spaces is encoded by randomly changing one letter to another letter. For instance, all d 's may be changed to c 's and spaces changed to q's. If the message uses every letter in the alphabet plus a space, then there are a total of 27! possible codes, with only one being correct. If the message uses S symbols, then there are 27! - S! possible encodings that work. A chromosome consists of 27 genes with unique values from 1 to 27. A 1 corresponds to a space and 2 through 27 correspond to the letters of the alphabet. Letters and spaces in the message receive the appropriate numeric values. The cost is calculated by subtracting the guess of the message from the known message, taking the absolute value, and summing:
We know the message when the cost is zero. As an example, let's see how long it takes the GA to find the encoding for the message "bonny and amy are our children." This message has 30 total symbols, of which 15 are distinct. Thus 15 of the letters must be in the proper order, while the remaining 12 letters can be in any order. The GA used the following constants: N pop = 400, N keep = 40, and m = 0.02. It found the message in 68 generations as shown in Figure 6.6. Progress on the decoding is shown in Table 6.1.