16.01.2013 Views

An Introduction to Genetic Algorithms - Boente

An Introduction to Genetic Algorithms - Boente

An Introduction to Genetic Algorithms - Boente

SHOW MORE
SHOW LESS

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 />

Chapter 4: Theoretical Foundations of <strong>Genetic</strong> <strong>Algorithms</strong><br />

Write a program <strong>to</strong> simulate a two−armed bandit with given ¼1, ¼2, Ã1 2 , Ã2 2 (which you should set).<br />

Test various strategies for allocating samples <strong>to</strong> the two arms, and determine which of the strategies<br />

you try maximizes the overall payoff. (Use N 1000 <strong>to</strong> avoid the effects of a small number of samples.)<br />

Run a GA on the fitness function defined by equation 4.5, with l = 100. Track the frequency of<br />

schemas 1* * * * *, 0* * * * *, and 111* * ** in the population at each generation. How well do the<br />

frequencies match those expected under the Schema Theorem?<br />

Replicate the experiments (described in this chapter) for the GA and RMHC on R1. Try several<br />

variations and see how they affect the results:<br />

Increase the population size <strong>to</strong> 1000.<br />

Increase pm <strong>to</strong> 0.01 and <strong>to</strong> 0.05.<br />

Increase the string length <strong>to</strong> 128 (i.e., the GA has <strong>to</strong> discover 16 blocks of 8 ones).<br />

Use a rank−selection scheme (see chapter 5).<br />

In your run of the GA on R1 measure and plot on−line and off−line performance versus time (number<br />

of fitness−function evaluations so far). Do the same for SAHC and RMHC.<br />

Design a fitness function (in terms of schemas, as in R1) on which you believe the GA should<br />

outperform RMHC. Test your hypothesis.<br />

Simulate RMHC and the IGA <strong>to</strong> verify the analysis given in this chapter for different values of N and<br />

K.<br />

5.1 WHEN SHOULD A GENETIC ALGORITHM BE USED?<br />

The GA literature describes a large number of successful applications, but there are also many cases in which<br />

GAs perform poorly. Given a particular potential application, how do we know if a GA is good method <strong>to</strong><br />

use? There is no rigorous answer, though many researchers share the intuitions that if the space <strong>to</strong> be searched<br />

is large, is known not <strong>to</strong> be perfectly smooth and unimodal (i.e., consists of a single smooth "hill"), or is not<br />

well unders<strong>to</strong>od, or if the fitness function is noisy, and if the task does not require a global optimum <strong>to</strong> be<br />

found—i.e., if quickly finding a sufficiently good solution is enough—a GA will have a good chance of being<br />

competitive with or surpassing other "weak" methods (methods that do not use domain−specific knowledge in<br />

their search procedure). If a space is not large, then it can be searched exhaustively, and one can be sure that<br />

116

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!