Evolutionary Methods and Evolutionary Computation 33
one of which is the mutation of nodes. Here, o nly the selec ted node is replaced
with another node.
The crossover ope rator in GAs and GP s ignificantly differ from other prob-
abilistic optimization mechanisms. The mutation operator searches nearby
structures by slightly changing good solutions. On the other hand, the
crossover operator aims to obtain better s olutions by combining good so-
lutions. For instance, in a function identification pr oblem to identify x
4
, the
partial str ucture x
2
has higher fitness compared to x. In fact, x
2
can be a
partial structure of x
4
. T he concept behind GP is that better solutions can be
obtained by repeatedly using crossover to co mbine good small partial struc-
tures called building blocks that formed, fo r example, through mutation.
Crossover in GAs is an exchange of partial sequences, and crossover in
GP is an extension where partial trees are exchanged. Here, partial trees are
chosen in two individuals selected through selection, and these se lec ted partial
trees are exchanged. Figure 2 .13(right) is an example of crossover in GP. 1 + x
and sin z are chosen as partial trees in this example. The crossover points
are selected at random; however, randomly selecting nodes without distin-
guishing ter minal and non-termina l nodes results in many exchanges of labe ls
between terminal nodes. Terminal nodes cannot be building blocks by them-
selves; therefore non-terminal nodes are preferentially chosen for cro ssover in
standard GP.
An important condition in ge netic operations in GP is that only individuals
with correct syntax are always generated when the above crossover or mutation
(except mutation of entire nodes) is used. GP uses tree structures to represent
genes so that the meaning is not destroyed by genetic operators.
2.3.6 Simulating wall following robots
Let us attempt to evolve a progr am for controlling a robot using GP. The
task here is to obtain a program that causes the robot to follow a wall (this
could be useful for controlling a cleaning robot, since dust tends to gather
against walls). The robot is capable of four motions: to move forward, move
back, turn right, and turn left. It has a group of se nsors that provide a 360-
degree view . It is placed in an irre gular room (i.e., a n asymmetric room) and
commanded to move about the periphery of the roo m, following the wall as
accurately as possible.
This kind of progra m is easy to write in Lisp [76]. Let us begin with the
adaptive learning necessary to s olve this problem with the GP.
The robo t is as sumed to have 12 sonar sensors (s00–s11) (see Fig. 2.14).
The four motions permitted to the robot are straight ahead, straight back,
turn left (+30 degrees ), and turn right (−30 degrees). Since this GP carries
out learning, the terminal nodes T are
T = {S00, S01, ··· , S11, ℜ}
where S00, S01, ··· , S1 1 are the values output by the 12 distance sensors. ℜ is