Hybrid spiral-dynamic bacteria-chemotaxis algorithm with application to control two-wheeled machines

This paper presents the implementation of the hybrid spiral-dynamic bacteria-chemotaxis (HSDBC) approach to control two different configurations of a two-wheeled vehicle. The HSDBC is a combination of bacterial chemotaxis used in bacterial forging algorithm (BFA) and the spiral-dynamic algorithm (SDA). BFA provides a good exploration strategy due to the chemotaxis approach. However, it endures an oscillation problem near the end of the search process when using a large step size. Conversely; for a small step size, it affords better exploitation and accuracy with slower convergence. SDA provides better stability when approaching an optimum point and has faster convergence speed. This may cause the search agents to get trapped into local optima which results in low accurate solution. HSDBC exploits the chemotactic strategy of BFA and fitness accuracy and convergence speed of SDA so as to overcome the problems associated with both the SDA and BFA algorithms alone. The HSDBC thus developed is evaluated in optimizing the performance and energy consumption of two highly nonlinear platforms, namely single and double inverted pendulum-like vehicles with an extended rod. Comparative results with BFA and SDA show that the proposed algorithm is able to result in better performance of the highly nonlinear systems.

Nasir et al. [33,34,36] proposed linear and nonlinear adaptive BFA where the bacteria step size is varied based on the combination of bacteria and iteration index. Chen and Lin [14], Farhat and El-Hawary [18] and Huang and Lin [22] utilized index and total number of chemotaxis to vary bacteria step size within a specified range. Niu et al. [39], Yan et al. [57] and Xu et al. [56] varied the step size within a user-defined range using combination of index and total number of iterations. Supriyono and Tokhi [49] developed various versions of BFA based on linear and nonlinear mathematical formulations to establish relationship between bacteria step size and their current fitness value. This relationship enables bacteria to have different step sizes in similar iteration as well as through the whole operation. There are other adaptive approaches considered the variation of the step size based on fitness value [16,28,29,44,45,54]. Nasir et al. [30][31][32] proposed adaptive spiral-dynamic algorithm (ASDA) to establish relationship between spiral radius (r) and fitness value of each search point. They introduced schemes to make variation in the spiral radius within a specific range, enabling each search point to have different spiral radius in moving from one location to another location. Moreover, the movement step of each search agent was made with respect to its fitness value at the current location. As a result of the variation, there was improvement to the performance mainly on the accuracy of the final solution.

Hybrid optimization techniques
Hybrid approach is the combination of two or more algorithms aimed to retain the advantages and eliminate the weaknesses of the original algorithms. This includes the synergization between different groups such as bioinspired, nature-inspired, etc. Biswas et al. [10,11] proposed hybrid BFA-PSO where a chemotactic strategy of bacteria was designed to represent exploitation part of the algorithm, while the exploration of optimum location was accomplished by PSO. The same approach using a constant step size was implemented by Korani [26], where the PSO operator was used to determine new direction of bacteria motion. Ghaffar et al. [19] adopted a modified PSO operator to determine new direction of bacteria to avoid local optima solution. Biswas et al. [11] proposed chemotactic differential evolution algorithm where adaptive chemotactic strategy of bacteria has been used to improve fitness accuracy of classical differential evolution (DE). Sinha et al. [47] implemented the same approach on an electric power system. Kim et al. [24] and Kim [25] used GA and BFA to tune a PID controller for automatic voltage regulation. Panigrahi and Ravikumar [40] and Hooshmand et al. [21] incorporated Nelder-Mead method into bacteria chemotaxis phase to enhance the search strategy and improve bacteria location. Other hybrid approaches involving BFA [41,59] used bee colony algorithm and Tabu search.

Limitations of BFA and SDA
BFA is a well-known bio-inspired algorithm. It has a comparable or better performance compared to other types of optimization algorithm [17]. Therefore, it has been adopted by many researchers worldwide to solve realworld problems in many areas [52]. However, BFA has a slow convergence speed and longer computation time. Due to this issue, the application of original BFA in online and offline tuning for solving a complex real-world problem is unsatisfactory [15]. On the other hand, SDA is a relatively new and a simple algorithm developed inspired from natural spiral phenomena on earth. It has a relatively fast convergence speed which can complement the drawback of BFA performance. Previous study showed that SDA has a similar or better performance compared to other differential evolutionary (DE) and particle swarm optimization (PSO) algorithms [50,51]. However, SDA has a premature convergence issue where it hardly provides an optimal solution for complex problems.

Hybrid spiral-dynamic bacteria-chemotaxis
A hybrid bacteria-chemotaxis spiral-dynamic algorithm (HSDBC) has been proposed by Nasir et al. [30][31][32] to synergize the chemotactic strategy of bacteria and ASDA. The chemotaxis phase in BFA was designed such that it represents exploration stage and placed at the first phase of the algorithm, while the ASDA as the exploitation stage and was placed at the second phase of the algorithm. The combination simplified the BFA algorithm and greatly reduced the total computation time of BFA. Moreover, comparison with original algorithms concluded that it improved the accuracy of the final solution and had the capability to avoid the local optima problem. HSDBC is a new variant of hybrid-type BFA-SDA algorithm developed to solve the issues aforementioned above. Our previous study showed that the algorithm outperformed both BFA and SDA algorithms in terms of accuracy in finding a global optima solution. Compared to BFA, the total computation time has been significantly reduced and its convergence speed has been considerably increased [31,37].
Full description of the HSDBC algorithm for n-dimensional optimization is shown in Fig. 1. The description of the associated parameters used in the algorithm is shown in Table 1, and the corresponding flow chart is given in Fig. 2. The HSDBC algorithm has been tested to model and control nonlinear systems including flexible robot manipulator and a twin rotor system using a PD-like FLC [35,37].

Contribution overview and paper organization
Establishing the optimal control strategy for nonlinear dynamic systems, specifically inverted pendulum-based systems, has been and still remains a field of interest for a countless number of research studies due to their various promising real-life applications including personal transport systems and wheelchairs. This paper presents an extended study of the proposed algorithm in solving complex problem of two-wheeled inverted pendulum systems. We will implement HSDBC algorithm to control two different configurations of two-wheeled machines. A detailed simulation study of the HSDBC algorithm using several unimodal and multimodal benchmark functions can be found in the work of Nasir and Tokhi [37]. A hybrid fuzzy-like PD and I controller is designed and implemented on the two systems. This paper is organized as follows: "Background" section introduces both ASDA and ABFA optimization algorithms, along with an explanation of the principle of HSDBC algorithm. In order to test and validate the proposed HSDBC algorithm on real dynamic systems, two case studies are considered in the study and are introduced in "Methods" section. "Case study I: single IP with an extended rod" section describes in details the first case study that involves a single inverted pendulum (IP) system. A double IP system with an extended rod is considered as the second case study and is presented in "Case study II: double IP with an extended rod" section. The results of the investigation are presented at the end of each of the previously mentioned sections, sections "Case study I: single IP with an extended rod" and "Case study II: double IP with an extended rod". At last, the paper is concluded in "Conclusion" section.

Methods
An inverted pendulum as a typical multi-input multi-output system has the characteristics of nonlinear, multivariable and close coupling Luo et al. [27]. The uniqueness and wide application of technology derived from this unstable system has drawn interest of many researchers including Akesson et al. [2], Askari et al. [5] and Balan et al. [6,7]. There are various applications of IP configuration including design of walking gaits, wheelchairs, and personal transport systems.
The system considered in this paper is a two-wheeled machine (TWM) with an extendable rod as described by Goher et al. [20] and verified by Almeshal et al. [3,4]. This system stabilizes it extendable intermediate body (IB) by controlling the wheel movements in a desired manner. A TWM is designed such that either Step 0: Preparation Select the number of search points (bacteria) m ≥ 2 , parameters 0 ≤θ tumble ,θ swim < 2π,0 < r tumble , r swim <1 of S n (r,θ), maximum iteration number, k max and maximum number of swim, N s for bacteria chemotaxis.

Step 1: Initialization
Set initial points x i (0) ∈ R n , i = 1, 2,...m in the feasible region at random and center x * as Step 2: Applying bacteria chemotaxis ii. Bacteria swim (a) Check number swim for bacteria i.
Otherwise set s = N s , and return to step (i).

Step 4: Checking termination criterion
If k = k max then terminate. Otherwise set k = k +1, and return to step 2 the center of mass of the robot is above or below the axle joining two wheels. Statically unstable TWM have evoked a lot of interest in present decade [8]. Two case studies are used to test and validate the developed algorithm; single IP and double IP with an extended rod. For consistency, the two systems are considered to move along an inclined surface. The results of the simulation are shown in a comparative manner with three different optimization algorithms; BFA, SDA and HSDBC.

System description
The system comprises a rod on an axle incorporating two wheels as shown in Figs. 3 and 4. The numerical parameters of the system are described in "Appendix 1". Full details on the system description are available in Almeshal et al. [3,4].

Mathematical modeling of the single IP with an extended rod
Lagrange-Euler formulation is used to derive the system dynamic model using the following n-coordinates dynamic equations: where Q i is generalized force vector and q i is generalized coordinate vector. The coordinate vector is selected as: and the force vector as:

Control strategy
Three independent control loops, shown in Fig. 5, are implemented on the system. Fuzzy PD-like combined with conventional integrator is designed as shown in Fig. 6. The three control loops are working to: stabilize the 2C 8Q − C 16θẏ cos(θ + α) − 2C 12 Qθ 2 − C 13θ 2 − C 16 g cos θ = F a IB at the vertical upright position, keep the cart wheels within a specified linear position from a predefined reference while moving on an inclined surface, and to control the linear displacement of the payload along the IB. The inputs to the three control loops are the error signal, change of error and the sum of previous errors. The system inputs are the driving force F c , the linear actuator force F a and the disturbance force F d . FLC controllers are developed based on Mamdani-type fuzzy inference engine with (25) fuzzy rules shown in Table 2.

Constrained optimization
The optimization process is constrained within the stability region of the system. Each parameter has a feasible interval that guarantees the stability of the system within the defined gain limits. Table 3 presents the limits of each parameter which represent the search space of each of    the three addressed algorithms. Those parameters were obtained through a manual tuning exercise of the system.

Objective functions
The performance index of the system is chosen as the minimum mean squared error (MSE) of each control loop. The MSE is calculated for each control loop of the vehicle system using the following equations: The objective function of the system is calculated based on the total MSE which can be expressed as: The parameters used to implement the three optimization algorithms are shown in Tables 4, 5 and 6 and the calculated optimized parameters are shown in Table 7. The data shown in Table 8 gives the minimum cost functions due to the implementation of the three optimization algorithms where the HSDBC algorithm was able to give the minimum cost function compared to the BFA and SDA optimizations.

Simulation results
Four consecutive simulation runs of the system model yielded the performance of the system as shown in Fig. 7.

Objective_function(i)
As noted from Fig. 6; the three optimization algorithms; BFA, SDA and HSDBC, resulted generally in a satisfactory performance of the system. However, HSDBC algorithm showed a superior performance in minimizing the percentage overshoot in the payload displacement as appeared in Fig. 7c. As per the tilt angle shown in Fig. 7b, all the three algorithms behaved the same in terms of minimizing the level and period of oscillations. As per convergence graph shown in Fig. 8 show that the three algorithms resulted in similar convergence of the cost function within around 25 iterations. However, the HSDBC was faster in convergence of the cost function too early if compared to the BFA and SDA algorithms.
Attention has been focused on energy consumption in this investigation. The control effort components as a measure of energy consumption are shown in Fig. 9. It is noted that the control effort required in the transient range; the three algorithms yielded nearly close results. However, the HSDC was more robust as it resulted less oscillation of the control effort components in the magnified areas of the plots. Significant amount of energy saving has been achieved specifically in the cart and tilt angle control efforts as appeared in Fig. 9a, b. Furthermore, the HSDBC resulted in a great improvement in the control effort for the payload; this can be demonstrated by the significant improvement shown in Fig. 9c in terms of less oscillations and the short time taken by the control signal to stabilize.

Case study II: double IP with an extended rod
In this case study, an additional link is added and hence increasing the degrees of the freedom (DOF) and the complexity of the structure. The double IP with such configuration shown in Fig. 10 is mimicking the scenario of     a wheelchair on only two wheels which has been studied significantly by Ahmad and Tokhi [1]. The design of the two-wheeled robotic vehicle is based on double inverted pendulum system with a movable payload moving on an inclined surface with five DOF. The increased DOFs will enable the vehicle to maneuver freely in all directions and in different environments. Moreover, the second link provides an extended height to lift up the payload to a demanded height. The system equations of motion are presented with five highly coupled differential equations as follows: (12) 2 C 27δL + 2C 1δR + C 6θ1 cos(θ 1 + α) − C 6θ 2 1 sin(θ 1 + α) + 0.5(C 25 + C 26 Q) θ 2 cos(θ 2 + α) −θ 2 2 sin(θ 2 + α) + 0.5C 28Qθ2 cos(θ 2 + α)

Control strategy
A robust hybrid fuzzy logic control strategy (FLC) with five control loops is developed. The control strategy block diagram is presented in Fig. 11, to control the vehicle and to counteract the disturbances occurring due to different movement scenarios.
The control system of the vehicle consists of five hybrid FLC controllers with a total of 15 gain parameters. The gain parameters were first tuned heuristically in order to test the controller as well as to find the boundaries of the search space of those gain parameters. The same optimization algorithms, SDA, BFA and HSDBC, are implemented in order to optimize the vehicle control system parameters. The performance index of the system is chosen as the minimum mean squared error (MSE) for each control loop and defined as: The objective function is chosen as the summation of the MSE of the system expressed as: Minimization of the objective function J is used to find the optimal controller gain parameters that result in the minimum control loop errors in the stability region of the system.

Constrained optimization
With the complexity of the model, slight changes in the control gain parameters will result in oscillations in the system response and may lead to instability of the vehicle. Constrained optimization techniques are used to avoid this problem occurring while optimizing the control system parameters. The optimization process is constrained within the stability region of the system. This is achieved by defining a feasible interval for each control parameter shown in Table 9, which assures the stability of the system.

Results and discussion
This simulation scenario allows comparing the performance of the HSDBC with other similar optimization algorithms. Tables 10, 11 and 12 provide the simulation     parameters used for BFA, SDA and HSDBC algorithms, respectively. The optimized control gain parameters reported by each optimization algorithm are presented in Table 13, whereas Table 14 provides the minimum cost function calculated by each of the optimization algorithms. Clearly, the HSDBC algorithm has found the minimum cost function value of 0.3682. Figure 13 shows the system response based on the optimized control parameters obtained by the implementation of the BFA, SDA and HSDBC algorithms in comparison to the manual-tuned gain parameters. It can be noted that BFA, SDA and HSDBC are of much similar effect on the system response by finding stable solutions, lowering the overshoots and improved steady-state error. However, HSDBC algorithm has a superior performance in minimizing the percentage overshoot and the settling time for the linear displacement of the left and right wheel as shown in Fig. 13a, b and the tilt angles of the two pendula as shown in Fig. 13c, d. Furthermore, HSDBC-optimized gain parameters clearly improved the settling time of the payload actuator displacement as depicted in Fig. 13e.
As can be noticed from the cost function convergence plots shown in Fig. 12, the HSDBC algorithm cost function has converged into the minimum value within approximately 25 iterations. However, the BFA and SDA algorithms seem to need more iterations to settle into their best-found minimum values presented in Table 14. HSDBC has successfully found the minimum cost function and proved its speed in convergence. In terms of the control output components shown in Fig. 14, the control efforts was minimized by the implementation of HSDBC algorithm for the left wheel, first link and the payload linear actuator. However, the heuristic tuning yields better results in case of the right wheel and the second link. This seems to be accompanied with a poor response of the system, in terms of increased disturbance period and higher gain values, if compared to the results obtained by the HSDBC algorithm.

Conclusions
A novel hybrid spiral-dynamics bacteria-chemotaxis (HSDBC) optimization algorithm has been proposed. Chemotactic strategy of bacteria through spiral tumble and swim actions of bacteria is adopted to improve exploration strategy of SDA. Moreover, spiral radius    saving in the energy consumption of the two tested platforms. Future work will consider investigating standard PID tuning methods, such as Ziegler-Nichols method, and evaluating and comparing their performance with the HSDBC algorithm.   L u = C 5 + Q L m = C 6 + Q J m = M m (Q 2 + (C 4 − 2L g )Q + L 2 g − 2L g C 6 + C 3 ) J u = M u (Q 2 + (C 2 − 2L g )Q + L 2 g − 2L g C 5 + C 1 )