3.3.3. ANN Optimization by Genetic Algorithm

GA is a meta-heuristic, population-based searching algorithm based on natural selection [66,67]. In this method, each individual in the population can generate a solution by reproducing the individuals, and the solution should converge on the best one. In this study, an individual includes four genes such as the number of the hidden layer, the number of nodes at the hidden layer, learning rate and momentum coefficient, formed as shown in Equation (7).

$$\dot{a} = (c\_1, c\_2, c\_3, c\_4),\tag{7}$$

where *i* represents an individual chromosome and *c*1 to *c*4 are binary codes for the four genes. A population is composed of a number of individual chromosomes, which can be expressed as *I* = (*i*1, *i*2, *i*3,... *in*), *n* denotes the number of individual chromosomes.

GA uses three operators like selection, crossover and mutation to produce next generation chromosomes with better fit. The selection operator chooses the chromosomes with better fit based on the selection criteria defined in the algorithm. In the crossover operator the two selected parent chromosomes were merged from a new solution, which makes the probability of the best fit higher in the next generation. Different crossover rules can be used. In this study, a random crossover from two parents was employed. The mutation operator can make random changes to the chromosome features to avoid the local optimum. The details of the GA can be found in other studies [68,69]. The main parameters were used in Genetic Algorithm are shown in Table 2.

**Table 2.** Main parameters of GA algorithm used for optimizing ANN.

