Abstract

This paper presents a method for dynamic parameter adaptation in the harmony search algorithm (HS) based on fuzzy logic. The adaptation is performed using Type 1 (FHS), interval Type 2 (IT2FHS), and generalized Type 2 (GT2FHS) fuzzy systems as the number of improvisations or iterations advances, achieving a better intensification and diversification. The main contribution of this work is the dynamic parameter adaptation using different types of fuzzy systems in the harmony search algorithm applied to optimization of the membership functions for a benchmark control problem; in this case it is focused on the ball and beam controller. Experiments are presented with the HS, FHS, IT2FHS, and GT2FHS with noise (uniform random number) and without noise for the controller, and the following error metrics are obtained: ITAE, ITSE, IAE, ISE, and RMSE, to validate the efficacy of the proposed methods.

1. Introduction

This paper presents a method based on different types of fuzzy systems, whose main goal is the dynamic parameter adaptation in metaheuristic algorithms [1, 2]. These algorithms are now increasingly being used to solve different problems like optimization of functions, controllers [3, 4], neural networks [5], and engineering [6, 7], among others. This work is based on the original harmony search algorithm which tries to mimic the improvisation process of musicians in finding a pleasing harmony and has been widely used to solve complex problems [8, 9]. There are different variants for the parameter adaptation of HS such as Adaptive Harmony Search Method for Structural Optimization [10], Parameter-Setting-Free Harmony Search Algorithm [11], and Self-Adaptive Global Best Harmony Search algorithm [12]. The main disadvantage of this algorithm is the use of fixed parameters throughout the iterations and premature convergence. The main goal of this work is to use the concepts of fuzzy sets to design a fuzzy system that adjusts dynamically harmony memory accepting (HMR) parameters and with its fuzzy rules controls the exploitation of the harmony search algorithm. The granular term is used herein to indicate the number of membership functions to be used in the fuzzy system. The proposed method called fuzzy harmony search algorithm (FHS) uses Type 1, interval Type 2, and generalized Type 2 fuzzy systems for dynamic parameter adaptation while other works have made different methods based on this algorithm such as [1023]. The main contribution of this work is to perform dynamic parameter adaptation using Type 1, interval Type 2, and generalized Type 2 fuzzy system in the harmony search algorithm applied to optimization of the membership functions of a fuzzy controller for a benchmark problem. In this case it is focused on the ball and beam controller, which has the goal to maintain the balance of the ball in the beam. This problem was considered with the original and the proposed methods, with noise and without noise for the controller. This is in order to validate the effectiveness of the proposed method.

This paper is organized as follows: Section 2 describes concepts of fuzzy logic systems, Section 3 describes the concepts of fuzzy logic controllers, Section 4 describes the original harmony search method, Section 5 describes the proposed method, Section 6 shows the description of the ball and beam controller, Section 7 presents experiments and results, Section 8 presents a statistical comparison, and finally Section 9 offers the conclusions.

2. Fuzzy Logic Systems

Fuzzy logic was conceived by Lotfi. A. Zadeh in 1965, on the basis of a theory of fuzzy sets, which differs from the traditional crisp sets, because the degree of belonging is considered. At present, the use of logic systems (FLS) has increased, as can be observed in [2430]. The Interval Type 2 fuzzy set has a fuzzy membership function, the membership grade for each element of this set is a fuzzy set in , as can be observed in [3135]. In generalized Type 2 fuzzy sets the uncertainty is represented in volume and is able to handle greater uncertainty in the system. Some generalized Type 2 advances in the literature are presented in [3640].

3. Fuzzy Controllers

A fuzzy logic controller (FLC) is widely used today to control any plant; the main advantage of using it is that it does not require knowledge of the mathematical model, and in the following papers type 1 fuzzy controllers have been successfully used [41, 42]. In Figure 1 the generic representation of the FLC is illustrated.

4. Original Harmony Search Algorithm

The Harmony search (HS) algorithm has been recently developed as an analogy with the music improvisation process where music players improvise the pitch of their instruments to obtain better harmony [9, 43]. This algorithm has 5 steps that are the following.

Step 1. Initialize the problem and algorithm parameters as follows:

Step 2. Initialize the harmony memory (HM), HM matrix is filled with as many randomly generated solution vectors as the HMS, as follows:

Step 3. Improvise a new harmony from the HM. Equation (3) represents the HMR, (4) represents the pitch adjustment, and (5) represents the random selection operators:

Step 4. Update the harmony memory vector,

Step 5. Validate the stopping criterion. The maximum number of iterations is satisfied; computation is terminated. Otherwise, Steps 3 and 4 are repeated.

5. Fuzzy Harmony Search Algorithm

The proposed method is based on the HS algorithm; in previous works the behavior of the original harmony search algorithm was studied; tests were performed with the “PArate” and HMR parameters and making adjustments to the HMR parameter achieves better results. The value of the HMR parameter is fixed during the process of improvisation of the algorithm; based on this it is decided to adjust this parameter with fuzzy system. The main contribution is to dynamically change the HMR parameter using type 1 (FHS), interval type 2 (IT2FHS), and generalized type 2 (GT2FHS) fuzzy systems as the number of iterations advances and with this to achieve more diversity of solutions. The diagram of the proposed method is illustrated in Figure 2.

5.1. Performance Representation of the Type 1 Fuzzy System

The proposed type 1 fuzzy system (FHS) is composed using terms of type 1 fuzzy sets, granulated into the three triangular membership functions in the input and the output, and these triangular membership functions are represented bywhere and parameters locate the “Corner” of the triangle and the parameter locates the center. The following equations represent the knowledge of the input and output of the fuzzy system.

5.1.1. Input and Output Variables

To build a type 1 fuzzy system, the input and output linguistic variables are determined; in this case, there is one input and one output. The input variable is the Iteration; this variable has the following membership functions (MFS): Low, Medium, and High. The fuzzy system has a single output called HMR, which refers to the harmony memory accepting parameter, and this variable has the following MFS: Low, Medium, and High. These MFS are listed in Table 1.

Table 1 shows the equations for constructing the MFS of the input and output variables of the type 1 fuzzy system.

5.2. Knowledge Representation of the Interval Type 2 Fuzzy System

The proposed interval type 2 fuzzy system (IT2FHS) is composed using terms of interval type 2 fuzzy sets, granulated into the three triangular MFS with uncertain in the input and the output, and these triangular MFS are represented by where , , and parameters are for the upper MFS and , , and are for the lower MFS. The following equations represent the knowledge of the input and output variables of the interval type 2 fuzzy system.

5.2.1. Input and Output Variables

To build an interval type 2 fuzzy system, we used the same general structure of the type 1 fuzzy system and the same linguistic variables mentioned above; in this case, we have one input and one output. These MFS are listed in Table 2.

Table 2 shows the equations for constructing the MFS of the input and output variables of the interval type 2 fuzzy system.

5.3. Knowledge Representation of the Generalized Type 2 Fuzzy System

The proposed generalized type 2 fuzzy system (GT2FHS) is composed using terms of generalized type 2 fuzzy sets, granulated into the three triangular MFS with Gaussian in the secondary membership in the input and the output, and these triangular MFS are represented bywhere , , and parameters are for the upper MFS and , , and are for the lower MFS, respectively, where is fraction of uncertainty of the support for the secondary membership function. The following equations represent the knowledge of the input and output of the generalized type 2 fuzzy system.

5.3.1. Input and Output Variables

To build a generalized type 2 fuzzy system, we used the same general structure of the type 1 fuzzy system and the same linguistic variables mentioned above; in this case, we have one input and one output. These MFS are listed in Table 3.

Table 3 shows the equations for constructing the MFS of the input and output of the generalized type 2 fuzzy system.

5.4. Design of the Fuzzy Harmony Search Systems (FHS, IT2FHS, and GT2FHS)

In Sections 5.1, 5.2, and 5.3 the knowledge of the membership functions to be used in the FHS, IT2FHS, and GT2FHS fuzzy systems were presented. In this section the graphical representation of the fuzzy systems is determined by Figures 3, 4, and 5, respectively, where we used one input, which is the iteration, and one output, which is the HMR parameter and is of Mamdani type.

It is decided to make the HMR dynamic parameter using (9), as the iterations progress:where the memory accepting rate is HMR; the number of rules of the fuzzy system is , corresponding to hmr; is the output result for rule i corresponding to hmr; is the membership function of rule i corresponding to hmr.

The fuzzy system is of Mamdani type and contains three fuzzy rules. The rules are summarized in Table 4.

Table 4 represents the idea of increasing the output of the rules as iterations are progressing. To represent this idea the following equation was used:where the current iteration is divided by the maximum of iterations, obtaining a percentage as the number of iterations progress.

6. Case of Study

This section explains in detail the operation of the ball and beam controller which has been used to test the effectiveness of the proposed method.

6.1. Ball and Beam Controller

The objective of this control model is to achieve the balance of the ball in the beam, where it is allowed to roll with one degree of freedom along the length of the beam. A lever arm is attached to the beam at one end and a servo gear at the other. As the servo gear turns by an angle , the lever changes the angle of the beam by . When the angle is changed from the horizontal position, gravity causes the ball to roll along the beam. According to the Euler-Lagrange method, the mathematical model of motion for the ball and beam system is presented in (11) and the beam angle () can be expressed in terms of the angle of the gear (), presented in (12).A controller is designed for this system so that the ball’s position can be manipulated. The representation of this is illustrated in Figure 6.

The variables and constants in this case are defined in Table 5.

This controller contain four inputs which are , , , and , respectively, and are granulated into two generalized bell membership functions. The outputs are linear functions composed of 16 linear equations. Figure 7 shows the structure of the fuzzy system for this controller and Figure 8 shows the plant of the ball and beam system. This controller is of Takagi Sugeno type and uses 16 fuzzy rules, which are presented with more detail in Box 1.

7. Experiments and Results

The results obtained by optimizing the input membership functions using the proposed method with FHS, IT2FHS, and GT2FHS fuzzy systems are presented. This methodology was applied to the ball and beam controller, where the goal is to maintain the balance of the ball in the beam. 30 experiments with the HS method have been performed and also experiments with perturbation and without perturbation in the controller were carried out with the FHS, IT2FHS, and GT2FHS fuzzy harmony search algorithms. The noise applied for this controller is with a Gaussian distribution with a level of 0.05. The perturbation was obtained with (13). In this case it is decided to use this type of noise since in the previous work [13] we obtained favorable results by applying this same level of perturbation to the water tank, temperature, and the mobile robot controller.Table 6 summarizes the values obtained for each criterion considering 1000 units of time. For calculating ITAE a sampling time of = 0.1 s was considered. Figure 9 illustrates the perturbation applied to the controller. The root mean square error (RMSE) is the objective function of the controller, although there are other control metrics that were also used which are the following: ISE (Integral of Squared error), IAE (Integral of the Absolute value of the Error), ITSE (Integral of Time-weighted Squared Error), ITAE (Integral of the Time multiplied by the Absolute value of the Error), and SNR (Signal to noise ratio), respectively, presented inTo optimize the input membership functions, (20) was used where the parameter is usually positive, the parameter is the width of the function, and the parameter locates the center of the curve.The harmony representation that was generated to carry out the optimization of the input membership functions of the ball controller is illustrated by Figure 10.

Figure 10 indicates the structure of the harmony with which the points of the membership functions are optimized for each input; in this case there are four inputs with two gbell membership functions. The output of the ball and beam controller contains 16 linear functions that are described in Box 2, and these outputs are not optimized.

The parameters used are as follows: 100 iterations, PArate 0.75, HMR 0.95 (only for the HS, in the FHS, IT2FHS, and GT2FHS methods, this parameter changes dynamically with fuzzy system), and HM 30. Table 6 shows the simulation results obtained using the ball and beam controller without perturbation in the controller and Table 7 shows the simulation results obtained using the ball and beam controller under perturbations. Tables 6 and 7 show an average of 30 experiments for each method.

Table 6 summarizes the results obtained for each method without perturbation: Fuzzy HS with Type 1 (FHS), Fuzzy HS with interval type 2 (IT2FHS), and Fuzzy HS with generalized type 2 (GT2FHS). The averages of the results obtained with each of the methods are illustrated in Figure 11.

Table 7 shows the results obtained with 30 carried experiments for each method with perturbation: Fuzzy HS with Type 1 (FHS), Fuzzy HS with interval type 2 (IT2FHS), and Fuzzy HS with generalized type 2 (GT2FHS). The results of each error in each method are an average of the 30 experiments carried out. The SNR used for the three methods are 7.3531 dB for Type 1, 8.1232 dB for Interval Type 2, and 8.1232 dB for Generalized Type 2 for the ball and beam controller.

The averages of the results obtained with each of the methods are illustrated in Figure 12.

Figure 13 illustrates the behavior of equilibrium for each method without noise in the controller and Figure 14 the behavior of equilibrium for each method with noise in the controller, (a) FHS, (b) IT2FHS, and (c) GT2FHS. The blue line represents the set point and the pink line represent the ball position.

It can be observed that when applying noise to the controller the generalized type 2 FHS method was achieved to obtain a better balance.

The best result is achieved by applying perturbation to the ball and beam controller using the generalized type 2 FHS. In this experiment, the best RMSE of 1.5827 is obtained; the distribution of membership functions is shown in Figure 15.

8. Statistical Comparison

To validate the effectiveness of the proposed method, a statistical test was applied; in this case the Z-test was used. The claim, parameters, and data for the hypothesis testing are as follows:

Sample 1 would be the GT2FHS, IT2FHS, and FHS methods with perturbation and sample 2 would be the GT2FHS, IT2FHS, and FHS methods without perturbation. The mean of the proposed method with perturbation is less than the mean of the other method without perturbation (Claim). The hypotheses would be as follows:

The Z-value is obtained by the following equation

Once the Z-value and P value have been calculated, we can say that there is enough evidence for all values below the critical value Z or -1.645; we can reject the null hypothesis and we can state that the mean of the proposed method with perturbation is lower than the mean of the other method without perturbation with a 95% of confidence and this Z-value is shown in Table 8.

Table 8 shows the results of the mean, standard deviation, and the Z-value and P value obtained; in the 3 cases significant evidence is obtained when comparing the proposed method with perturbation against the method without perturbation. With this we can verify that when using uncertainty, a better stability is achieved in the ball and beam controller.

9. Conclusions

In this work the dynamic parameter adaptation with type 1, interval type 2, and generalized type 2 fuzzy system for the harmony search algorithm is presented. Parameter adaptation is responsible for optimizing the values of input membership functions of the ball and beam controller, where the objective is to maintain the balance of the ball in the beam. This methodology was applied with the original HS algorithm and with the proposed FHS algorithm with noise and without noise for the controller. A perturbation of 0.05 was used to check the stability of the method, since theoretically if more uncertainty is handled in a problem it must have more stability. The results obtained from the 30 experiments for each method show that when perturbation is applied stability is achieved; we can observe that using generalized type 2 fuzzy system with perturbation or without perturbation for the controller. The optimization of this problem is able to obtain better results than with the other methods presented in this paper. It can be verified that when using perturbation for the controller results are improved.

Data Availability

The data will be available upon request.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.