28 Agent-Based Modeling and Simulation with Swarm
• Nodes to be used
• Design of parameters in the problem
The fitness function evaluates the appropriateness of a solution to the
problem. The design of this fitness function can completely change the ten-
dencies in the solutions tha t will be obtained. Actual examples of the fitness
function will be given later.
Which nodes to use, which is the second factor, is important bec ause it
determines the size of the solution space. For instance, when the tra ining
data in a function regression problem is generated by sin x + x, the solution
generated by GP will not be a good approximation of the training data if
the non-terminal nodes consist only of +, −, ×, and ÷. On the other hand,
using too many nodes would result in the solution space becom ing too big.
This means that mor e calculations are necessary before arriving at a solution.
Therefore, the nodes to be used must be chosen appropriately, no t more and
not less.
The third factor is the choice of parameters in GP, and parameters that
determine the performance of searches in GP include po pulation size, mutation
rate, crossover rate, tournament size (in the case of tournament selection),
and maximum tree depth. Searches in a GA a re typically carried out with a
small number of individuals (∼ 10 0), whereas mo re individuals are used in GP
(generally 1000–10,000 but it depends on the problem). The mutation rate is
the ratio of individuals in the population that mutate and is usually about
0.1–0.2. The crossover rate is a similar parameter, and is typically about 0.8.
GP uses tree structures and therefore the length is not fixed; however, a limit
is usually imposed on the size of the tree structures. The number of nodes
increases ex ponentially in GP due to the bloat phenomenon. Limiting the
maximum depth and maximum number of nodes can prevent the generation
of excessively large tree structures. Solutions are searched in GP after the
above three factors are determined.
Algorithms in GP include the fo llowing steps:
1. Random generation of initial population
M individuals are generated if the number of individua ls in the popula-
tion is M. The initial individuals are generated randomly.
2. Fitness evaluation
Fitness scores are determined by the fitness function fo r all M individ-
uals.
3. Selection
Good solutions a re selected through a predetermined selection algo-
rithm.
4. Mutation and crossover
Mutation and crossover operations are performed on selected good so-
lutions.