A common strategy for creating the GA’s initial population is to use a uniform random distribution to uniformly cover the search space. If good solutions are known, they are often seeded into the initial population. The best individuals from the population are selected based on their fitness—in this case, forecasting accuracy. One of the most popular selection approaches is the stochastic uniform method. This method maps the individuals to contiguous line segments whose length is proportional to the individual fitnesses. The individuals are selected for crossover by placing equally spaced pointers (as many as the number of individuals to be selected) over the line. Longer line segments correspond to fitter individuals, which have a higher chance of being selected. This method can spread the genes associated with good features while retaining a satisfactory level of population diversity. Crossover then proceeds to recombine the “genetic material” of the selected parents. One of the most common ways to perform the crossover is the scattered method, in which a random vector of 0 and 1 with the same genome length is used to select the genes coming from each parent.
The crossover operator selects genes from the first parent where the vector has 0 entries, and selects genes from the second parent when it has 1 entry, giving rise to a new individual. In order to guarantee the diversity of the population, the mutation operates on the individuals that have not been selected for reproduction. Mutation can be achieved by adding a random number with a Gaussian distribution to every gene in the genome. The Gaussian distribution has 0 mean and a standard deviation that shrinks as the number of generations increases. Once the population for a new generation is determined, this process continues until some criterion (typically no improvement over a prespecified number of generations) is met. Figure 15.4 is a schematic of the ANN algorithm optimized by the GA.