# Optimization of Fuzzy Logic Controller Used for a Differential Drive Wheeled Mobile Robot
## 2 Problem Description
### Optimization of the Fuzzy Logic Controller Based on the Genetic Algorithm
#### 3.2.2 Fitness Functions Used for the Genetic Algorithm  
In the GA, the FF is defined to obtain the FF value for each chromosome and to determine which one will be reproduced and taken into the next generation. So, with a particular chromosome, the FF returns a single numerical score, which is proportional to the ability of the chromosome (in this study, the score is a value of the energy consumption of the robot). The Equation (2) is used as the FF for the optimization process of the FLC based on the GA to minimize the energy consumption of the DDWMR. To design an optimal FLC, first, an initial FLC is designed to navigate the DDWMR to the goal. Then, a GA process is executed in the Google Colab(r) by using the Python language with the help of \"pymoo\" library to find the optimal parameters of the MFs. It must be noticed that a single FF evaluation asks for running a complex simulation. Thus, running a full optimization process could need thousands of simulations. For such an extensive task, a quite powerful computer is needed. As FF evaluation could be done independently several FF computations can be run simultaneously. In this case, a computer cluster supporting distributed computation could help [37]. However, some kind of benchmarking and selection of several algorithms which promise effectiveness should be done [38]. The optimization process of the FLC with the help of the genetic algorithm is depicted in Figure 10.  
The FLC is created according to the chromosome, which represents all parameters of the MFs, and consequently, its behavior is tested by a simulation process. Results of such simulation are transformed into fitness function value. Such a process of mapping from the proposed solution to the fitness function result allows the use of optimization  
Figure 10: The optimization process used for optimization of the fuzzy logic controller. Several well-known effective motion controllers used to compare with the GA_FLC are the expert-based FLC [1], the Thoa-based FLC [6], the Circular-based controller [39], the energy-saving based algorithm introduced by [PERSON] et al. [22; 23], and the Mohammad-based FLC_GA [40], the Robins Mathew-based controller [41; 42]. Their coefficients are given in Table 6.  
Some given paths used for testing the robot motion control in this simulation are a zigzag path, a square path, a sharp turn path, a straightforward path, and a diamond-shaped path. These given paths are defined by several given points in a unit of a meter as in Table 7. In addition, a number eight-shaped path created by \((x=2+10\sin(\pi t/30)\) and \(y=1+5\sin(2\pi t/30))\), and a circle path created by \((x=-8+8\cos(\pi t/30)\) and \(y=4+8\sin(\pi t/30))\) are also used to test the ability tracking of the DDWMR when using the GA_FLC. The rules and the MFs of the several used fuzzy logic controllers are as follows:  
For the initial FLC: the rules are shown in Tables 3 and 4. The parameters of the MFs are shown in Tables 1 and 2. For the expert-based FLC: the rules are shown in Table 1 of [1]. The parameters of the MFs are shown in Tables 8 and 9. For the Thoa-based FLC: the rules are shown in Tables 2 and 3 of [6]. The parameters of the MFs are used the same as the MFs of the initial FLC shown in Tables 1 and 2. For the Mohammad-based FLC_GA controller: based on the [PERSON] method [40], the input MFs and the rules can be used the same as the initial FLC. [PERSON] et al. have only optimized output MFs. According to them, for optimization of the MFs it only need to optimize the overlaps between the output MFs [40]. The output MFs used for the Mohammadian-based FLC_GA controller are represented in Figure 12. In Figure 12, B1-B4 are overlaps between the output MFs which need to tune. The values of these overlaps are selected in the range [0 to 7.5].