1 Introduction

There are several metaheuristics currently being used to solve many real-life problems such as: problems of mathematical optimization (Ochoa et al. 2019; Rodríguez et al. 2017; Bernal et al. 2017), control problems (Amador-Angulo and Castillo 2018; Castillo et al. 2018; Bernal et al. 2019), engineering problems (Dhiman and Kumar 2019a, b; El-Shorbagy et al. 2002; Lee et al. 2019), scheduling problems (Halim and Ismail 2019; Karagul et al. 2019; Roy and Sen 2019; Pongchairerks 2019) among many others. These metaheuristics usually have parameters that help the diversification and intensification properties in exploring of the search space, but use fixed parameters. To solve the problem of the fixed parameters within an algorithm, probabilistic methods (Bansal et al. 2019; Dechter 2019; Wang et al. 2019), fuzzy logic (Santiago et al. 2019; Olivas et al. 2019; Peraza et al. 2019) among others have been put forward. Fuzzy logic aims at creating mathematical approximations in the solution of certain types of problems because it provides the ability of modeling uncertainty, vagueness and imprecision present in the majority of real-world problems. It aims to produce accurate results from inaccurate data, which is why it is particularly useful in electronic or computational applications. It is defined as a mathematical system that models nonlinear functions, which converts inputs into outputs according to the logical approaches used by approximate reasoning. Fuzzy Logic is very popular for its wide range of applications. In general, it is applied to both to control systems of complex industrial processes and to model any continuous system of engineering, physics, biology or economics. These concepts are applied to the decision making process in a fuzzy logic controller, which has been elevated from a fuzzy Type-1 system (T1-FLS), to become an interval type-2 Fuzzy system (T2-FLS) where uncertainty could be incorporated directly into fuzzy sets. When uncertainty is considered, system improvements are obtained, resilience against noise and handling of unknown data, and there are several tasks where this knowledge has been applied as shown in Peraza et al. (2018), Olivas et al. (2018) and Geem et al. (2001).

The main contribution of this paper is to solve the problem of using fixed parameters in the original harmony search algorithm (Geem et al. 2001; Lee and Geem 2005), which is based on jazz improvisation, by using an interval type-2 fuzzy logic system (IT2-FHS) that is responsible for dynamically adjusting the parameter throughout the iterations and is applied to the optimization of a control case that uses an interval type-2 fuzzy logic controller (IT2-FLC). Experiments were performed without noise and with noise within the interval type-2 fuzzy logic controller for a control case.

The rest of the paper is organized as follows. Section 2 introduces the original harmony search algorithm. In Sect. 3, the proposed IT2-FHS is discussed. The case study and optimization method are characterized in Sect. 4. Experiments and results are given in Sect. 5. In Sect. 6 a comparison with other methods is presented. The statistical test is shown in Sect. 7. Finally, Sect. 8 offers the conclusion.

2 Original harmony search algorithm

The Harmony search algorithm (HS) is a recently proposed metaheuristic search technique that mimics the process of music improvisation, the concept of the HS was introduced by Geem et al. (2001), and it is inspired by the improvisation of music, specifically referred to jazz. There are different variants of this algorithm as they have been created to improve it or for solving specific problems (Mahdavi et al. 2007; Wang and Huang 2010; Geem 2008). The HS algorithm and its variants have been used in multiple areas of applications, such as engineering problems (Yi et al. 2019a, b; Schaedler de Almeida 2019; Nazari-Heris et al. 2019) Public Key Cryptography (Mitra et al. 2019), route problem (Boryczka and Szwarc 2019), medical area (Selvakumar et al. 2019), among others. This method is composed of the following steps, which are:

Step 1: Initialize the problem and parameters

$$ {\text{Minimize}}\,\,f\left( x \right) \,\,{\text{s}} . {\text{t}} . \,\, x\left( j \right) \in \left[ { {\text{LB}}\left( j \right), {\text{UB}}\left( j \right), j = 1,2, \ldots , n} \right] $$
(1)

where \( f\left( x \right) \) describes the objective function, \( x\left( j \right) \) describes the decision variables, \( n \) describes the number of design variables and \( {\text{LB}}\left( j \right), \,{\text{UB}}\left( j \right) \) describes the lower and upper of the design variables, respectively.

Step 2: Initialize the Harmony memory (HM)

The harmony memory (HM) is a matrix of harmony solution vectors, where its size depends on the Harmony Memory Size (HMS). The HM is occupied by many randomly generated solution vectors and sorted by the objective function value, where \( X_{i} = \left\{ {x_{i} \left( 1 \right), x_{i} \left( 2 \right), \ldots , x_{i} \left( n \right)} \right\} \) represents the ith harmony vector, which is randomly generated as follows: \( x_{i} \left( j \right) = {\text{LB}}\left( j \right) + \left( {{\text{UB}}\left( j \right) - {\text{LB}}\left( j \right)} \right) \times r \) for \( j = 1,2, \ldots ,n \) and \( i = 1,2, \ldots ,{\text{HMS}}, \) where r is a uniform random number in the interval [0, 1].

$$ {\text{HM}} = \left[ {\begin{array}{*{20}c} {x_{1}^{1} } & {x_{2}^{1} } & \ldots & {x_{N}^{1} } & {f\left( {x^{1} } \right)} \\ {x_{1}^{2} } & {x_{2}^{2} } & \ldots & {x_{N}^{2} } & {f\left( {x^{2} } \right)} \\ \vdots & \vdots & \vdots & \vdots & \vdots \\ {x_{1}^{\text{HMS}} } & {{\text{x}}_{ 2}^{\text{HMS}} } & \ldots & {x_{N}^{\text{HMS}} } & {f\left( {x^{\text{HMS}} } \right)} \\ \end{array} } \right] $$
(2)

Step 3: Improvise a new harmony

This step is the most important because it influences the overall performance of the HS algorithm. A new harmony memory vector is improvised using three selected operators, which are the memory considerations (HMR), pitch adjustment (PAR) and randomization. The random numbers, \( r_{1} \) and \( r_{2} \) are ranged from 0 to 1. In each improvisation or iteration, if \( r _{1} \) is less than HMR the solution vector, \( x_{{{\text{new}} }} \left( j \right) \) is generated from the memory consideration, otherwise, \( x_{{{\text{new}} }} \left( j \right) \) is selected through randomization. Next, is \( r_{2} \) is less than the PAR, the solution vector \( x_{{{\text{new}} }} \left( j \right) \) from the memory consideration is further modified with the bandwidth distance using Eq. (3)

$$ X_{\text{new}} \left( j \right) = X_{\text{new}} \left( j \right) \pm r \times {\text{BW}} $$
(3)

where r is a uniform random number ranging from 0 to 1. The function of BW is of an arbitrary distance bandwidth. The value of BW is determined by the changes in quantity of the new solution vector and its presence is enhanced by the performance of HS.

Step 4: update harmony memory

To update the HM with a new solution vector, \( x_{\text{new }} \), the objective function will be used to evaluate it. A comparison is made to see if the new vector solution is better than the worst historical vector solution and the worst historical is excluded and substituted with a new one.

Step 5: Check the stopping criteria

The process is repeated until the number of improvisations (NI) is satisfied; otherwise, the process repeats steps 3 and 4. Finally, the best solution is achieved and considered as the best result to the problem. The HMR parameter represents the intensification or exploitation, the PAR and Randomization parameters represent the diversification or exploration in the algorithm.

3 Proposed approach (IT2-FHS)

This section presents a modification to the HS algorithm with dynamic adjustment parameter by using interval type-2 fuzzy logic in the harmony search algorithm (IT2-FHS). Interval type-2 fuzzy logic has been applied recently in solving nonlinear control due to its ability for achieving a good management of uncertainty. This uncertainty is represented by intervals, which represent an infinite amount of embedded T1-FLS. The T2-FLS is computationally more complex in comparison with the T1-FLS, but they manage to be more resistant to noise and therefore obtain better results. T2-FLSs have been used in multiple areas of applications, such as robotics (Yang et al. 2019), control area (Olivas et al. 2019; Castillo et al. 2019; Roy et al. 2019; Basu et al. 2019; Ontiveros et al. 2018; Ontiveros-Robles et al. 2017), image processing (Yi et al. 2019b), safety risk performance in industries (Jana et al. 2019), medical area (Ramirez et al. 2019; Guzmán et al. 2019).

An Interval type-2 fuzzy set is represented by two membership functions, a lower and an upper one; the area that lies between these membership functions is called a footprint of uncertainty (Zadeh 1988, 1975; Castillo and Amador-Angulo 2017). The mathematical expression is as follows:

$$ \tilde{A} = \left\{ {\left( {\left( {x,u} \right),1} \right)|\forall_{x} \in X, \forall_{u} \in J_{x} \subseteq \left[ {0,1} \right]} \right\} $$
(4)

where \( \mu_{{\tilde{A}}} \left( {x,u} \right) \) represents the membership degree of each element, \( X \) is the primary domain and \( J_{x} \) is the secondary domain.

In this paper interval type-2 fuzzy logic is used for dynamically adjusting the HMR parameter in harmony search algorithm as the iterations advance, and this methodology is tested with the problem of optimization of the membership functions for the water tank interval type-2 fuzzy controller. The block diagram of the proposed method can be found in Fig. 1.

Fig. 1
figure 1

Block diagram of the proposed method

In previous work (Peraza et al. 2017) this methodology was used for dynamic adjustment of parameters with type-1 and interval type-2 applied to the optimization of different Type-1 fuzzy controllers. The proposed interval type-2 fuzzy system consists of one input and one output, the input is the iteration which is calculated based on Eq. (5) and the output is the HMR parameter which is calculated based on Eq. (6). Both are composed of three triangular IT2 membership functions, based on Eq. (7).

$$ {\text{Iteration}} = \frac{\text{Current Iteration}}{\text{Maximun of iterations}} $$
(5)
$$ {\text{HMR}} = \frac{{\mathop \sum \nolimits_{i = 1}^{{r_{\text{hmr}} }} \mu_{i}^{\text{hmr}} \left( {{\text{hmr}}_{1i} } \right)}}{{\mathop \sum \nolimits_{i = 1}^{{r_{\text{hmr}} }} \mu_{i}^{\text{hmr}} }} $$
(6)
$$ \begin{aligned} \tilde{\mu }\left( x \right) & = \left[ {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\mu } \left( x \right),\bar{\mu }\left( x \right)} \right] = {\text{itritype}}2\left( {x,\left[ {a_{1} ,b_{1} ,c_{1} ,a_{2} ,b_{2} ,c_{2} } \right]} \right) \\ \mu_{1} \left( x \right) & = { \hbox{max} }\left( {\hbox{min} \left( {\frac{{x - a_{1} }}{{b_{1} - a_{1} }},\frac{{c_{1} - x}}{{c_{1} - b_{1} }}} \right),0} \right) \\ \mu_{2} \left( x \right) & { \hbox{max} }\left( {\hbox{min} \left( {\frac{{x - a_{2} }}{{b_{2} - a_{2} }},\frac{{c_{2} - x}}{{c_{2} - b_{2} }}} \right),0} \right) \\ \end{aligned} $$
(7)

Equation (5) represents a percentage of the current iterations and the maximum of the iterations with which the algorithm works and the description of variables, Eq. (6) is the memory accepting rate is HMR; the number of rules of the fuzzy system is \( r_{\text{hmr}} \), corresponding to hmr; \( {\text{hmr}}_{1i} \), is the output result for rule i corresponding to hmr; \( \mu_{i}^{\text{hmr}} \), is the membership function of rule i corresponding to hmr and Eq. (7) is the representation of the triangular interval type-2 membership functions (itritype2), which consist of 6 parameters \( a_{1} , b_{1} , c_{1} , a_{2} , b_{2} \quad {\text{and}}\quad c_{2} ,\quad {\text{where }}a_{1} < a_{2, } b_{1} < b_{2 } \quad {\text{and}}\quad c_{1} < c_{2 ,} \) as shown in Fig. 2.

Fig. 2
figure 2

Itritype2 membership function

The knowledge of the proposed interval type-2 fuzzy system in this work IT2FHS is represented in Table 1.

Table 1 Knowledge of the interval type-2 fuzzy harmony search (IT2FHS)

Table 1 shows the parameters of each triangular interval type-2 membership functions for each input and output, and the linguistic values are low, medium and high, respectively.

This knowledge is represented graphically in Fig. 3 and this is applied to the optimization of the water tank interval type-2 fuzzy controller and Fig. 4 shows the rules of the proposed system.

Fig. 3
figure 3

Interval type-2 fuzzy harmony search (IT2FHS)

Fig. 4
figure 4

Rules for the interval type-2 fuzzy harmony search (IT2FHS)

The rules presented in Fig. 4 increase the HMR value as the iterations advance, to explore in low iterations and exploit in high iterations.

4 Case study and optimization methodology

There are several benchmark control cases, such as the inverted pendulum (Castillo et al. 2018, 2019), temperature control (Boryczka and Szwarc 2019; Castillo and Amador-Angulo 2017) among others. In this case the water tank controller was used and was converted to at interval type-2 fuzzy logic controller. This controller is optimized to minimize the error achieved with the methodology proposed in Sect. 3.

4.1 Case study

In this case the water tank controller was used, which aims to maintain the water level in the tank. The graphic representation of this controller is shown in Fig. 5.

Fig. 5
figure 5

Graphic representation of the water tank controller

The mathematical model of this controller is expressed in Eq. (8):

$$ h \left( t \right) = h \left( 0 \right) + \mathop \int \limits_{0}^{t} \frac{1}{A}\left( {q_{\text{in}} \left( {t^{\prime}} \right) - q_{\text{out}} \left( {t^{\prime}} \right)} \right) {\text{d}}t^{\prime} = \mathop \int \limits_{0}^{t} \frac{1}{A}\left( {q_{in} \left( {t^{\prime}} \right) - a\sqrt {2gh \left( {t^{\prime}} \right)} } \right){\text{d}}t^{\prime} $$
(8)

The fuzzy system for this problem is of Mamdani type-1. In this case, the fuzzy system is converted to an interval type-2 fuzzy logic controller (Castro et al. 2007), which is composed of two inputs which have three Gaussian interval type-2 membership functions based on Eq. (9) and a one output which has five triangular interval type-2 membership functions based on Eq. (7).

$$ \mu_{{\begin{array}{*{20}c} {\tilde{F}\left( x \right) = \left[ {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\mu }_{{\tilde{F}}} \left( x \right),\bar{\mu }_{{\tilde{F}}} \left( x \right)} \right] = {\text{igaussmtype}}2\left( {x,\left[ {\sigma ,m_{1} ,m_{2} } \right]} \right)} \\ {\mu_{{\tilde{F}}} \left( x \right) = \exp \left[ { - \frac{1}{2}\left( {\frac{x - m}{\sigma }} \right)^{2} } \right] m \in \left[ {m_{1} ,m_{2} } \right]} \\ {\mu_{1} \left( x \right) = \exp \left[ { - \frac{1}{2}\left( {\frac{{x - m_{1} }}{\sigma }} \right)^{2} } \right]} \\ {\mu_{2} \left( x \right) = \exp \left[ { - \frac{1}{2}\left( {\frac{{x - m_{2} }}{\sigma }} \right)^{2} } \right]} \\ \end{array} }} $$
(9)

Equation (9) is the representation of the Gaussian interval type-2 membership functions (igaussmtype2) which consist of 3 parameters \( \sigma ,m_{1} \,\,{\text{and}} \,\,m_{2} \) as shown in Fig. 6.

Fig. 6
figure 6

Gaussian membership function

The knowledge of the interval type-2 water tank controller is presented in Table 2.

Table 2 Parameters of the interval type-2 water tank controller

Table 2 represents the parameters of each Gaussian and triangular interval type-2 membership functions for each input and output, the linguistic variables are presented.

This knowledge is represented graphically in Fig. 7, the surface of the FLC is presented in Fig. 8 and the rules of the interval type-2 water tank controller are presented in Fig. 9.

Fig. 7
figure 7

Interval type-2 water tank controller

Fig. 8
figure 8

Surface of the interval type-2 water tank controller

Fig. 9
figure 9

Rules of the interval type-2 water tank controller

4.2 Optimization methodology

The proposed IT2FHS method is used to optimize the inputs values of the interval type-2 membership functions of the water tank controller in order to minimize the RMSE error described in Eq. (10) and other used metrics are presented in Eqs. (11)–(14). These metrics have been used in various work as: (Sanchez et al. 2015; Amador-Angulo et al. 2016), Fig. 10 shows the specific harmony that represents the information of the individuals.

Fig. 10
figure 10

Harmony that represents the parameters of membership functions

$$ {\text{RMSE}} = \sqrt {\frac{1}{N}\sum\nolimits_{t = 1}^{N} {\left( {x_{t} - \hat{x}_{t} } \right)^{2} } } $$
(10)
$$ {\text{ISE}} = \mathop \sum \limits_{t = 1}^{N} \left| {(x\left( t \right) - \hat{x}\left( t \right))^{2} } \right| $$
(11)
$$ {\text{IAE}} = \mathop \sum \limits_{t = 1}^{N} \left| {x\left( t \right) - \hat{x}\left( t \right)} \right| $$
(12)
$$ {\text{ITSE}} = \mathop \sum \limits_{t = 1}^{N} t \left( {(x\left( t \right) - \hat{x}\left( t \right))^{2} } \right) $$
(13)
$$ {\text{ITAE}} = \mathop \sum \limits_{t = 1}^{N} t \left( {x\left( t \right) - \hat{x}\left( t \right)} \right) $$
(14)

The harmony contains the position of each individual of the Gaussian interval type-2 membership function. In total there are 48 positions of which 30 (points of the output) are fixed and 18 are optimized (points of the inputs).

5 Experiments and results

The proposed IT2FHS method is applied to the optimization of the interval type-2 membership functions for the water tank controller. The parameters used for the experimentation are 1000 iterations, 40 harmonies, PAR 0.75 and 30 experiments without noise and with noise applied to IT2FLC are performed.

There are different types of noise such as Gaussian noise, band-limit white noise and the pulse generator. For this case study, noise that was used is in the form of a pulse generator, the amplitude, period, pulse width (%) and phase delay were set to 1, 10, 1.5, and 0, respectively.

The results presented in Tables 3 and 4 indicate the best, worst, mean, standard deviation and the ITAE, ITSE, IAE and ISE errors of the experiment without noise and noise using the proposed method, respectively.

Table 3 Results without noise
Table 4 Results with noise

Tables 3 and 4 show that when noise is applied to the interval type-2 water tank controller the achieved results are better. The best simulations obtained without noise and with noise are illustrated graphically in Figs. 11 and 12, respectively.

Fig. 11
figure 11

Best simulation obtained without noise

Fig. 12
figure 12

Best simulation obtained with noise

Figures 11 and 12 show the best simulations obtained with the proposed method IT2-FHS applied to the optimization of the interval Type-2 water tank controller, where the pink line indicates the desired simulation and the aqua green line indicates the simulation obtained. We can observe that when applying noise, the controller manages to maintain the desired stability. Figures 13 and 14 show the best structure obtained without noise and with noise.

Fig. 13
figure 13

Best structure obtained without noise

Fig. 14
figure 14

Best structure obtained with noise

Figure 15 illustrates the control surface obtained in the best simulation without noise (a) and with noise (b) in the controller.

Fig. 15
figure 15

IT2FLC control surfaces

6 Comparison with other methods

The case study of the water tank controller has been very used nowadays, in this section a compilation of several works of different authors is shown where this case study is used to perform a statistical comparison in Sect. 7.

In the previous paper (Peraza et al. 2017), dynamic parameter adaptation with type-1 and interval type-2 fuzzy system was used for the type-1 water tank fuzzy logic controller the results are shown in Tables 5 and 6. On the other hand, in a following paper (Ontiveros-Robles et al. 2017) the case study of the interval type-2 water tank fuzzy controller was used, which obtained an absolute average error of 3.81 × 10−2, therefore the proposed method obtains a better result as shown in Sect. 5.

Table 5 Errors obtained from the type-1 water tank controller simulation without noise
Table 6 Errors obtained from the type-1 water tank controller simulation with noise

The numbers shown in Tables 5 and 6 summarize the results obtained in the previous work (Peraza et al. 2017), where HS are the results obtained by using the original harmony search algorithm with fixed parameters along the iterations, T1-FHS are the results obtained when using the type-1 fuzzy harmony search with dynamic parameter adaptation along the iterations and finally the IT2-FHS are the results obtained by using the interval type-2 fuzzy harmony search with dynamic parameter adaptation along the iterations; it is important to mention that the three algorithms shown in these tables were applied to the optimization of the Type-1 water tank controller.

7 Statistical test

To validate the performance of the proposed method IT2FHS, a statistical z-test was performed and the proposed method is compared with other existing works in the literature.

The claim, parameters and data for the hypothesis testing are as follows:

$$ \begin{aligned} \mu_{1 } & = {\text{Proposed method without and with noise}} \\ \mu_{2 } & = {\text{Other method without and with noise}} \\ \end{aligned} $$

Sample 1 \( \left( {\mu_{1} } \right) \) would be the IT2FHS applied to the optimization of the IT2FLC water tank controller without and with noise and sample 2 \( \left( {\mu_{2} } \right) \) would be the HS-T1FLC, T1FHS-T1FLC and IT2FHS-T1FLC methods without and with noise, respectively. The mean of the proposed method without and with noise is less than the mean of the other method without and with noise (Claim). The hypotheses would then be as follows:

$$ \begin{aligned} & H_{o} :\mu_{1} \ge \mu_{2} \\ & H_{a} :\mu_{1} < \mu_{2 } ({\text{Claim}}) \\ & {\text{Alpha}} \left( \alpha \right) = 0.05 \\ & {\text{Level of confidence }} = \, 95\% \\ & {\text{Sample Size }}\left( n \right) \, = \, 30 \\ & {\text{Critical Value}} (Z_{o} ) = - 1.645 \\ \end{aligned} $$

The Z-value is obtained by the following Eq. (15).

$$ Z = \frac{{\left( {\bar{X}_{1} - \bar{X}_{2} } \right) - \left( {\mu_{1} - \mu_{2} } \right)}}{{\left( {\sigma_{1} - \sigma_{2} } \right)}} $$
(15)

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

Table 7 Results for the statistical test without noise in the controller
Table 8 Results for the statistical test with noise in the controller

The results obtained in Tables 7 and 8 show that the proposed method obtains significant evidence in most cases, with this we can verify that by making use of the interval Type-2 Fuzzy Logic that handles uncertainty for the dynamic parameter adaptation of this algorithm (HS) and applying this same methodology to a fuzzy logic controller, we obtain better results with respect to the other comparisons. It can be observed that there is not significant evidence when comparing the two interval type-2 controllers because both methodologies obtain better performance in comparison with the others.

8 Conclusions

This work discusses the importance of adapting the parameters of an algorithm using interval type-2 fuzzy logic. In this case, the approach is applied to the original harmony search algorithm. In previous works depth study, this algorithm and achievement identify the parameter that exploits the search space in this case is the HMR parameter which is the output of the fuzzy system in order to explore at low iterations and exploit at high iterations. The main advantage of using an interval type-2 fuzzy system is handling uncertainty among more complex the best problem results are obtained, the fuzzy logic controller of the water tank controller was converted to an interval type-2 fuzzy system and the proposed methodology was applied to optimize the membership functions of the inputs of this water tank controller in order to manage the level of uncertainty. Experiments were carried out without noise and noise in the water plant controller and significant evidence was obtained in most cases. It can be validated the results presented that performing dynamic parameter adaptation with interval type-2 fuzzy logic, better results are obtained with respect to the dynamic parameter adaptation with type-1 fuzzy logic and Type-1 fuzzy logic controller of the water tank controller with respect to other methods existing in the literature.

The motivation for the development of this paper was to verify the improvement with the proposed methodology for dynamic parameter adaptation based on interval type-2 fuzzy logic, applied to harmony search algorithm. The main contribution of this paper is the proposed use of the theory of interval type-2 fuzzy logic to the dynamic adjustment of parameter for the harmony search algorithm and applied to the optimal design of interval type-2 fuzzy logic systems as tools for modeling complex problems in benchmark control in this case the water tank controller.

For future work, we want to extend the proposed methodology for parameter adaptation to other benchmark control problems, apply other types and levels of noise and others problems such as the optimization of neural networks.