
149Guided Random Search Methods
as Rastrigin and Schwefel’s function to demonstrate that GA can locate the
global minimum for these functions.
The two-variable Rastrigin’s function (see Figure 5.6) is given by
f x x x x
x
( ) cos( ) cos( )
.
x = + − + −
− ≤
20 10 2 10 2
5 12
1
2
1 2
2
2
1
π π
,, .x
2
5 12≤
The function has a number of local optima and the global minimum value
of the function is f(x*) = 0 and occurs at x* = (0, 0). The function can be plotted
in MATLAB using the following commands.
0 200 400 600 800 1000
1225
1225.05
1225.1
1225.15
1225.2
1225.25
1225.3
1225.35
1225.4
Generation number
FIGURE 5.5
Variation of objective function value with increase in nu