An Introduction to Genetic Algorithms - Boente
An Introduction to Genetic Algorithms - Boente
An Introduction to Genetic Algorithms - Boente
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
COMPUTER EXERCISES<br />
1.<br />
2.<br />
3.<br />
4.<br />
5.<br />
6.<br />
7.<br />
*<br />
8.<br />
*<br />
Chapter 2: <strong>Genetic</strong> <strong>Algorithms</strong> in Problem Solving<br />
Implement a genetic programming algorithm and use it <strong>to</strong> solve the "6−multiplexer" problem (Koza<br />
1992). In this problem there are six Boolean−valued terminals, {a0, a1, d0,d1, d2, d3}, and four<br />
functions, {AND, OR, NOT, IF}. The first three functions are the usual logical opera<strong>to</strong>rs, taking two,<br />
two, and one argument respectively, and the IF function takes three arguments. (IF X Y Z) evaluates<br />
its first argument X. If X is true, the second argument Y is evaluated; otherwise the third argument Z<br />
is evaluated. The problem is <strong>to</strong> find a program that will return the value of the d terminal that is<br />
addressed by the two a terminals. E.g., if a0 = 0 and a1 = 1, the address is 01 and the answer is the<br />
value of d1. Likewise, if a0 = 1 and a1 = 1, the address is 11 and the answer is the value of d3.<br />
Experiment with different initial conditions, crossover rates, and population sizes. (Start with a<br />
population size of 300.) The fitness of a program should be the fraction of correct answers over all 2 6<br />
possible fitness cases (i.e., values of the six terminals).<br />
Perform the same experiment as in computer exercise 1, but add some "distrac<strong>to</strong>rs" <strong>to</strong> the function<br />
and terminal sets—extra functions and terminals not necessary for the solution. How does this affect<br />
the performance of GP on this problem?<br />
Perform the same experiment as in computer exercise 1, but for each fitness calculation use a random<br />
sample of 10 of the 2 6 possible fitness cases rather than the entire set (use a new random sample for<br />
each fitness calculation). How does this affect the performance of GP on this problem?<br />
Implement a random search procedure <strong>to</strong> search for parse trees for the 6−multiplexer problem: at each<br />
time step, generate a new random parse tree (with the maximum tree size fixed ahead of time) and<br />
calculate its fitness. Compare the rate at which the best fitness found so far (plotted every 300 time<br />
steps—equivalent <strong>to</strong> one GP generation in computer exercise 1) increases with that under GP.<br />
Implement a random−mutation hill−climbing procedure <strong>to</strong> search for parse trees for the 6−multiplexer<br />
problem (see thought exercise 2). Compare its performance with that of GP and the random search<br />
method of computer exercise 4.<br />
Modify the fitness function used in computer exercise 1 <strong>to</strong> reward programs for small size as well as<br />
for correct performance. Test this new fitness function using your GP procedure. Can GP find correct<br />
but smaller programs by this method?<br />
Repeat the experiments of Crutchfield, Mitchell, Das, and Hraber on evolving r = 3 CAs <strong>to</strong> solve the<br />
problem. (This will also require writing a program <strong>to</strong> simulate cellular au<strong>to</strong>mata.)<br />
62