Definition 2.2 Crowded Tournament Selection Operator: A solution wins a tournament with another solution if any of the following conditions are true:
5. A New Approach for Grammatical Evolution
5.2 Test Problems for Comparing GE and GP
In this section we state and describe three problem domains that we will use to test the performance of GE, in comparison with GP. These domains are: symbolic regression problem, symbolic integration problem and the Santa Fe ant trail. A description of each problem is as follows.
5.2.1 Symbolic Regression (SR)
Providing a given set of input and output pairs (data points) in the form (input, output), this problem aims to find the target mathematical function that generates the outputs from the corresponding inputs in each pair. To calculate a fitness value for a candidate solution to this problem, it is calculated by finding the error between the evolved and target functions for each pair of 20 data points and summing those errors as a fitness value. In total, we have five different target functions mixed with various types of components; they are x4 + x3 + x2 + x (SR1), sin(x) + x + x2 (SR2), log x + ex + x2 + x (SR3), sin(x) + ex + x3 + x2 + x (SR4) and sin(x) + x4 + x3 + x2 + x (SR5).
A BNF grammar used by GE for the symbolic regression problem and also for symbolic integration is defined in Figure 5-1.
173
Figure 5-1: BNF Grammar for both symbolic regression problem and symbolic integration problem
Configurations for symbolic regression problems are given in Table 5-1 and Table 5-2 for GE and GP respectively.
Symbolic Regression Configuration for GE
Objective
Find a target function that fits a given 20 data points in the form of (xi, yi) within interval [-1, 1] for SR1, interval [0, 2π]
for SR2, SR4 and SR5 and interval (0, 2] for SR3.
Terminal Operands The independent variable: X
Terminal Operators The arithmetic operators: +, -, *, / The unary operators: Sin, Cos, Exp, Log
Fitness Function The sum of the error over 20 data points
Parameters
Model: GE Steady State Population Size: 500 Generation Gap: 0.5 Generation Size: 50
Mutation Probability.: 0.01 Crossover Probability: 0.9
Table 5-1: Symbolic regression configuration for GE
N = { <Expr>, <Op>, <Pre-op> }
T = { Sin, Cos, Exp, Log, +, -, *, /, X } S = <Expr>
(A) <Expr> ::= <Expr> <Op> <Expr> (A.0)
<Pre-op> ( <Expr> ) (A.1)
<Var> (A.2)
(B) <Op> ::= + (B.0)
- (B.1)
* (B.2)
/ (B.3)
(C) <Pre-op> ::= Sin (C.0)
Cos (C.1)
Exp (C.2)
Log (C.3)
(D) <Var> ::= X (D.0)
174
Symbolic Regression Configuration for GP
Objective
Find a target function that fits a given 20 data points in the form of (xi, yi) within interval [-1, 1] for SR1, interval [0, 2π]
for SR2, SR4 and SR5 and interval (0, 2] for SR3.
GP Terminal Set The independent variable: X
GP Function Set +, -, *, /, Sin, Cos, Exp, Log
Fitness Function The sum of the error over 20 data points
Parameters
Model: GP Steady State Population Size: 500 Generation Gap: 0.5 Generation Size: 50
Mutation Probability.: 0.01 Crossover Probability: 0.9
Table 5-2: Symbolic regression configuration for GP
5.2.2 Symbolic Integration (SI)
The goal of this problem is to find a function that is the integral of the given curve represented by a given set of data points, and this type of problem can be reduced to symbolic regression. The same symbolic integration function as in [77] is used for our experiments, which is
cos 2 1
eq. 5-1
And, the target integral curve for the above function is
sin
eq. 5-2
Similarly to the approach in Koza [54], this particular symbolic integration problem can be reduced to the symbolic regression problem of finding the target function on the
175
target integral curve (eq. 5-2) instead and this is the same SR2 problem as in the previous section. The system is fed with a set of 20 input and output pairs in the form (xi, yi), and the fitness function is calculated in the same way. Please refer to the previous section for more detail.
5.2.3 Santa Fe Ant Trail (ANT)
The objective of the Santa Fe ant trail, a standard test problem for GP, is to obtain a computer program to control an artificial ant to discover 89 pieces of food on a 32×32 toroidal grid, and the ant has limited energy (615 energy units) to search in the grid.
Moreover, the ant spends one energy unit on each of the following actions: turn left, turn right, move one position forward; it may also look ahead one block in the direction it is facing to determine whether that block contains food or not without losing energy.
The fitness measure for this problem is simply the number of food pieces picked up by the artificial ant. A BNF grammar used by GE for the Santa Fe ant trail is defined in Figure 5-2.
Figure 5-2: BNF Grammar for Santa Fe ant Trail.
Configurations for Santa Fe ant trial are given in Table 5-3 and Table 5-4 for GE and GP respectively.
N = { <Code>, <Line>, <If-Else>, <Op> }
T = { TurnLeft(), TurnRight(), Move(), FoodAhead() } S = <Code>
(A) <Code> ::= <Line> (A.0)
<Code> <Line> (A.1)
(B) <Line> ::= If (FoodAhead()) {<Line>} Else {<Line>} (B.0)
<Op> (B.1)
(C) <Op> ::= TurnLeft() (C.0)
TurnRight() (C.1)
Move() (C.2)
176
Santa Fe Ant Configuration for GE
Objective
Find a computer program to control an artificial ant to search all 89 pieces of food spread through out a 32x32 toroidal grid.
Terminal Operands None
Terminal Operators TurnLeft(), TurnRight(), Move(), FoodAhead()
Fitness Function Number of food pieces picked up by the artificial ant before it run out of energy.
Parameters
Model: GE Steady State Population Size: 500 Generation Gap: 0.5 Generation Size: 50
Mutation Probability.: 0.01 Crossover Probability: 0.9
Table 5-3: Santa Fe ant configuration for GE
Santa Fe Ant Configuration for GP
Objective
Find a computer program to control an artificial ant to search all 89 pieces of food spread through out a 32x32 toroidal grid.
GP Terminal Set TurnLeft(), TurnRight(), Move(), FoodAhead()
GP Function Set <If-Else>, <Code>, <Line>
Fitness Function Number of food pieces picked up by the artificial ant before it run out of energy.
Parameters
Model: GP Steady State Population Size: 500 Generation Gap: 0.5 Generation Size: 50
Mutation Probability.: 0.01 Crossover Probability: 0.9
Table 5-4: Santa Fe ant configuration for GP