1 Introduction

Bio-inspired algorithms have been very useful in solving optimization problems (Deng et al. 2017; Bagloee et al. 2018; Ahmadigorji et al. 2017; Badem et al. 2018; Nazari-Heris and Mohammadi-Ivatloo 2018). In addition, to further improve these results, dynamic parameter adaptation has been used, and these adaptations can be of different types (Chang et al. 2019; Sun et al. 2019; Li and Cheng 2017; Aoun et al. 2018; Assaghir et al. 2017).

Dynamic parameter adaptation approaches using fuzzy inference systems have been used in different metaheuristics, such as Particle Swarm Optimization (PSO) (Olivas et al. 2016), Harmony Search Algorithm (HS) (Valdez and Peraza 2020), Differential Evolution Algorithm (Ochoa et al. 2020), Galactic Swarm Optimization (GSO) (Bernal et al. 2020), just to name a few. The Bird Swarm Algorithm (BSA) was previously utilized for neural network optimization in Miramontes et al. 2018a. The results suggest that the BSA can be modified to achieve better results and this motivated this work. The novelty of this work is the improvement of the BSA by using fuzzy dynamic parameter adaptation of the Cognitive (C1) and the Social (C2) acceleration coefficients, which helps the algorithm by improving the exploration and exploitation in the search space. Bird Swarm Algorithm was originally proposed by Meng in 2015 (Meng et al. 2016), mainly inspired by two behaviors of birds: social behavior and social interaction.

For the proposed method, we first studied which of the parameters, when changed produces a greater difference in the results. In this case, the parameters are the coefficients of cognitive, and social acceleration, respectively. Then three different fuzzy systems are created for which the rules are varied, using them in an ascending and descending way in addition to conducting experimentation with Trapezoidal and Gaussian membership functions to observe with which of these two variants, the better results are obtained.

In the experimental part, three case studies are carried out, in the first experiment with 10 classical mathematical functions; here as a disadvantage, it was not possible to differentiate which of the fuzzy systems provided the best result, since results were similar. For the second case study, 10 mathematical functions of the Congress on Evolutionary Computation 2017 (CEC2017) competition (Maharana et al. 2017; Salgotra et al. 2018) are used. In the third case, and most important case study, the optimization of the neural network architecture is carried out, in these two cases if a difference is observed in the fuzzy systems that provide better results. In addition, when comparing the results obtained with the original algorithm a significant improvement can be observed.

The main contribution presented in this work is to use the ability to manage uncertainty of fuzzy systems to perform dynamic parameter adaptation to the BSA algorithm in order to improve its performance, since it has been shown that by modifying bio-inspired algorithms in this way they have presented significant improvements in the results provided. The proposed method was used to optimize the architecture of an artificial neural network since it is part of a neuro-fuzzy model for obtaining a medical diagnosis based on blood pressure because the neural network should be able to produce accurate results.

This paper is structured as follows: Sect. 2 introduces the basic concepts, in Sect. 3, related works are described, in Sect. 4 the problem statement and proposed method are disclosed, in Sect. 5 the results of different experiments and the discussion are presented, and finally in Sect. 6 the conclusions and future work are outlined.

2 Basic concepts

2.1 Bird swarm algorithm

The Bird Swarm Algorithm (BSA) (Meng et al. 2016), is inspired by studying the behavior of birds in the swarm. These behaviors are social behavior, social interaction, mimic feeding, flying, and vigilance, which can be used in solving optimization problems.

BSA is relatively new, as it was proposed in 2015 by Meng. In this case, the social behaviors of birds are synthesized in the five rules listed as follows:

  • Rule 1 The behaviors of vigilance and foraging may switch in each bird. The two aforementioned behaviors are modeled as stochastic decisions.

  • Rule 2 Whereas in foraging, birds can record and update the best previous experience of each, and the swarms best previous experience regarding patch of food. The experience mentioned above can be used to search for food. Regarding social information, this is shared instantly between the complete swarm.

  • Rule 3 While vigilance is kept, all birds aspire to move to the middle of the swarm; this action can be affected by the interference provoked by the competition in the entire swarm. The Birds with the higher provisions will have a higher possibility of lying proximal to the center of the swarm than birds with low food reserves.

  • Rule 4 Birds habitually travel to different sites; birds can switch in producing and scrounging when this is done. The bird with the highest food reserve would be a producer, and the one with the lowest provisions would be a scrounger. Birds with intermediate provisions would randomly select to be a producer and scrounger.

  • Rule 5 Producers actively search for food. Scroungers would randomly follow a producer to search for food.

Mathematically, the previous rules can be analyzed as:

  1. (a)

    Foraging behavior

    For this, while each bird is looking for food based on its experience and the swarm’s experience, it is expressed by:

    $$ x_{i,j}^{t + 1} = x_{i,j}^{t} + \left( {p_{i,j} - x_{i,j}^{t} } \right) \times C X \times {\text{rand}} \left( {0,1} \right) + \left( {g_{j} - x_{i,j}^{t} } \right) \times S \, \times \,{\text{rand}} \left( {0,1} \right), $$
    (1)

    where \(j \in \left[ {1, \ldots ,D} \right],\;{\text{rand}}\left( {0,1} \right)\) are independent numbers uniformly distributed in the range of (0, 1).

    C and S can be called cognitive and social acceleration coefficients, respectively, and which each one represents two positive numbers. Pi,j represents the best previous position in the ith bird, and gj represents the best previous position in the swarm.

  2. (b)

    Vigilance behavior

    In this part, all the birds would attempt to move to the middle of the swarm and compete with others; for this, any bird would not move in a direct way to the center of the swarm; this is represented as follows:

    $$ x_{i,j}^{t + 1} = x_{i,j}^{t} + A1\left( {{\text{mean}}_{j} - x_{i,j}^{t} } \right) \times {\text{rand}}\left( {0,1} \right) + A2\left( {p_{k,j} - x_{i,j}^{t} } \right) \times {\text{rand}}\left( { - 1,1} \right) $$
    (2)
    $$ A1 = a1 \times \exp \left( { - \frac{{{\text{pFit}}_{{\text{i}}} }}{{{\text{sumFit}} + \varepsilon }} \times N} \right) $$
    (3)
    $$ A2 = a2 \times \exp \left( {\left( {\frac{{{\text{pFit}}_{{\text{i}}} - {\text{pFit}}_{{\text{k}}} }}{{\left| {{\text{pFit}}_{{\text{k}}} - {\text{pFit}}_{{\text{i}}} } \right| + \varepsilon }}} \right)\frac{{N \times {\text{pFit}}_{{\text{k}}} }}{{{\text{sumFit}} + \varepsilon }}} \right) $$
    (4)

In this expression, k is a positive integer randomly selected between 1 and N. pFiti denotes the best fitness value in the ith position and sumFit corresponds to the sum of the best fitness value of the swarms. \(\varepsilon\) is a small value which helps to avoid the error in zero-division. meanj is the jth element of the average place of the entire swarm. a1 and a2 represent positive constants in [0, 2].

Given that all the birds aspire to occupy the center of the swarm, the product of A1 and rand (0,1) could not be more than 1. A2 is utilized to simulate the direct effect produced by an interference when a bird moves toward the center of the swarm.

  1. (c)

    Flight Behavior

    Birds may travel to another place in response to predation threats, foraging, or any different situation. Once they are moved to a different area, the birds will look for food again. The producing birds search for food patches, whereas the scroungers attempt to feed on the food patch discovered by the producers. Mathematically these behaviors be can be analyzed as:

    $$ x_{i,j}^{t + 1} = x_{i,j}^{t} + {\text{randn}}\left( {0,1} \right) \times x_{i,j}^{t} , $$
    (5)
    $$ x_{i,j}^{t + 1} = x_{i,j}^{t} + \left( {x_{k,j}^{t} - x_{i,j}^{t} } \right) \times {\text{FL}} \times {\text{rand}}\left( {0,1} \right), $$
    (6)

In these expressions, randn (0, 1) represents Gaussian distributed random numbers with mean 0 and standard deviation 1, k \({ } \in { }\)[1,2,3… N], k ≠ i. FL (FL \(\in\) [0, 2]) expresses that the scrounger will follow the producer to look for food.

For simplification, Meng assumes that any bird can travel to another site every FQ unit interval, where FQ is a positive integer.

The pseudo-code of BSA is illustrated in Fig. 1.

Fig. 1
figure 1

BSA Pseudocode

2.2 Blood pressure

This term is defined as the force applied against the walls of the arteries when the heart pumps blood to the body. This pressure is determined by the size and flexibility of the arteries and strength and the amount of blood pumped (Papademetriou et al. 2019; Paul et al. 2019). The highest number is called Systolic pressure, which means the force exerted by the heart when pumping blood around the body. The lowest number is called Diastolic pressure and is when the heart relaxes and refills with blood, which is measured in millimeters of mercury (mmHg) (Papademetriou et al. 2019).

Based on the European Guidelines for management of hypertension, the normal blood pressure should be below 139 mmHg in systolic pressure and below 89 mmHg in diastolic pressure (Zanchetti et al. 2018).

2.3 High blood pressure

High blood pressure (also called hypertension) is the sustained elevation of blood pressure above normal limits (Bakris and Sorrentino 2018). The European Guidelines for management of hypertension classifies this condition into three grades:

  • Grade 1: is 140–159 mmHg in systolic pressure or 90–99 mmHg in diastolic pressure.

  • Grade 2: is 160–179 mmHg in systolic pressure or 100–109 mmHg in diastolic pressure.

  • Grade 3: is 180 or higher mmHg in systolic pressure or 110 or higher mmHg in diastolic pressure.

Additionally, another classification is defined, which is called Isolated Systolic Hypertension and this may occur when the Systolic pressure is higher or equal to 140 mmHg. However, the Diastolic pressure is lower than 90 mmHg (Zanchetti et al. 2018).

This condition does not present symptoms, so it can be confused with those of another disease. Some symptoms of severe hypertension are headaches, chest pain, nosebleeds, difficulty breathing, and dizziness (Texas Heart Institute 2017).

The exact causes by which a person can develop hypertension are not known, but are associated with the following risk factors: physical inactivity, alcohol and tobacco use, obesity, stress, salt consumption, and age (Texas Heart Institute 2017).

2.4 Framingham heart study

The Framingham Heart Study began in 1948 (Framingham Heart Study 2019), directed by the National Cardiac Institute, which was carried out to identify risk factors that have been the cause for the development of cardiovascular diseases.

This study begins by recruiting a group of 5209 men and women from Framingham, aged between 30 and 62 years old, who did not have any symptoms of cardiovascular disease or suffered a heart attack or stroke. Throughout the study, different groups of people have been added, such as the offspring of the first group in 1971, the multicultural group Omni in 1994, the third generation of the offspring’s in 2002, and the second group of Omni in 2003 (Framingham Heart Study 2019).

So far, different risk functions have been developed for the identification of other diseases, such as arterial fibrillation, coronary disease, diabetes, just to name a few.

One of the diseases that is included in these risk functions is high blood pressure. In this case, the risk function is a Weibull regression model, which can be used to find the percentage of risk that a patient has in developing hypertension in 4 years. To obtain the diagnosis, patient information is used, such as Age, Systolic Blood Pressure (SBP), Diastolic Blood Pressure (DBP), Body Mass Index (BMI), Sex, Smoking, Parental Hypertension.

The mathematical expression for the risk of developing hypertension is the following:

$$ {\text{FHS}}\;{\text{predictor}}\;{\text{risk}} = 1 - \exp \left[ { - \exp \left( {\frac{{\ln \left( 4 \right) - 22.94954 + \mathop \sum \nolimits_{i = 1}^{8} x_{i} }}{0.8769}} \right)} \right] $$
(7)

where:

x1 = − 0.15641*Age, x2 = − 0.20293*Sex, x3 = − 0.05933*SBP, x4 = − 0.12847*DBP, x5 = − 0.19073*Smoking, x6 = − 0.16612*Parental_Hypertension, x7 = − 0.03388*BMI, x8 = 0.00162*DBP*Age.

If the patient smokes, then the variable Smoking is assigned a value of one, otherwise it is assigned to 0. If none of the parents are hypertensive the variable Parental_Hypertension is assigned to 0, otherwise if one of the parents is hypertensive the it is assigned to 1 and finally, if both of the parents are hypertensive then it is assigned to 2 (“Framingham Heart Study” 2019).

3 Related works

The fuzzy dynamic parameter adaptation has been carried out in different algorithms to solve various problems. A sample of these recent related works is presented as follows.

In the work of Gaxiola et al. (Gaxiola et al. 2019), the authors proposed to perform dynamic parameter adjustment to the Particle Swarm Optimization algorithm using Interval Type-2 fuzzy systems. The main goal was to find optimal results for a particular problem, in this case for the optimization of a fuzzy neural network. The variables that are dynamically adjusted in the PSO are c1 and c2, which correspond to the cognitive and social factors, respectively. The proposed method was applied to the prediction of financial time series (stock exchanges in Germany, Mexico, Dow-Jones, London, Nasdaq, Shanghai, and Taiwan) and these results are compared with those obtained through a traditional neural network. Statistically, it is found that when performing the dynamic parameters adjustment to the PSO it provides better results than a non-optimized neural network.

To optimize different Benchmark control problems, Peraza et al. (Peraza et al. 2018) proposed the dynamic parameter adaptation for the Harmony Search Algorithm (HS) for optimizing the fuzzy controller of the ball and beam system. In this case, the harmony memory accepting (HMR) parameter changes in a fuzzy way to control the exploration. Different types of fuzzy systems (type-1 fuzzy system, interval type-2 fuzzy system, and general type-2 fuzzy systems) were used for the proposed method. When tests of the different fuzzy types are carried out, with the bar and beam controller, it can be observed that better results are obtained by adapting parameters with the general type-2 fuzzy system, even when levels of noise are applied to the plant. When comparing our proposal with the work described above, we can find that in BSA the fuzzy adjustment is carried out in the parameters that control the exploration and exploitation. Another difference is the optimized applications, the work in which the HS is used solves control problems, while in ours it is used to apply the optimization in medical problems. The advantages are that we can be adapted dynamically the two important parameters of the algorithm, which generates better results.

In another work by Lagunes et al. (Lagunes et al. 2020), they proposed to perform the fuzzy dynamic parameter adjustment to the Firefly Algorithm (FA) using Type-1 fuzzy systems and Interval Type-2 fuzzy systems. The proposed method adjusts the alpha variable of the algorithm, which corresponds to the exploration. To test the performance of the proposed method, different fuzzy controllers are used, such as the water level control tank and the temperature control in a shower, and it is observed that the results of adjusting with the fuzzy systems are very similar. However, when adding noise, the interval type-2 fuzzy system is better.

Neural networks have been used to solve problems in medical areas (Albu et al. 2019), and in this regard, the following works can be mentioned:

In the work of Mahboob et al. (Mahboob Alam, et al. 2019), they used different classification algorithms for the early prediction of diabetes. Several tools were also used to determine the selection of attributes and for the grouping, prediction, and mining of association rules for the mentioned disease, finding that the body mass index and glucose level are the most important attributes associated with developing diabetes. Similarly, different classification algorithms were used to observe which of them produced better results, such as random forest, K-means clustering, and artificial neural networks. The neural network performs better results than the other used methods, having an accuracy of 75.7%. The limitation that authors face is using a structured dataset.

In the work of Sadek et al. (Sadek et al. 2019), a neural network is utilized to predict Parkinson’s disease since it is difficult for doctors to detect it at early stages. To make this prediction they use 19 input variables, which are audio sections that were obtained from 31 people, of which 23 had Parkinson’s disease. The patient’s status is given as an output; this means it has a disease or is a healthy patient. As a result, precision of 100% is obtained when making the prediction.

Finally, for the recognition and classification of different types of intestinal parasites Takam et al. (Nkamgang et al. 2018) proposed a neuro-fuzzy system, which automatically classifies these parasites by microscopic images, which are provided as input. These images are preprocessed with different techniques for the detection of parasites and once having this, the information is provided to the neuro-fuzzy classifier to perform the classification. When comparing the results obtained with other authors, it can be concluded that the proposed method provides better results, 100% of recognition and classification are obtained in 20 classes of human intestinal parasites.

In other areas, neural networks and bio-inspired algorithms have been used to solve different problems, such as in the following works:

Regarding new swarm optimization methods, Mirjalili et al. (Mirjalili et al. 2017) presented two new algorithms in 2017, which are called Salp Swarm Algorithm (SSA) and Multi-objective Salp Swarm Algorithm (MSSA) to solve optimization problems with single and multiple objectives, respectively. These algorithms are inspired by the behavior of the swarm of salps when navigating and feeding in the oceans. The first test performed with both algorithms deals with mathematical functions, obtaining as a result that the SSA algorithm improves the initial random solutions effectively and can converge toward the optimum, while the MSSA can approximate optimal Pareto solutions with high convergence and coverage. When it comes to solving engineering design problems, such as airfoil design and marine propeller design, which are challenging and computationally costly, and it is shown that the proposed algorithms can solve problems with unknown and challenging search spaces.

For Benchmark function optimization, Parashar et al. (Parashar et al. 2017) proposed the Bird Swarm Algorithm (BSA), which is inspired by the behavior and social interaction in the swarm of birds. It was demonstrated that, with the BSA, the exploration and exploitation for optimization problems are carried out effectively and quickly. When comparing the BSA with other well-known optimization algorithms, such as GSA, PSO, among others, the results in most mathematical functions are superior and exhibit better performance. Once the comparative analysis was carried out, it was concluded that the BSA could effectively solve complex optimization problems in the real world.

We are in agreement with the authors of previous works in the literature with regards that combining fuzzy logic with optimization methods obtains better results than the corresponding original methods. In addition, the proposed method can be applied for the optimization of the different soft computing techniques in some of the previous mentioned works.

4 Problem statement and proposed method

The Bird Swarm Algorithm was proposed based on the behavior and social interaction of birds in swarms. These behaviors are: foraging, vigilance, and flight, each of them is implemented to optimize problems. This work aims at improving the BSA by updating the Cognitive (C1) and Social (C2) coefficients using fuzzy systems with Triangular and Gaussian membership functions: this helps the algorithm in exploitation and exploration in the search space in all the iterations. The idea is to obtain the values that give us the best results and help us to satisfactorily solve the optimization problem being considered. To test the presented proposal, three different Mamdani-type fuzzy systems were created. The difference in each of them is in the way the rules are ordered. In Fig. 2 the flowchart with the proposal of the dynamic adaptation of parameters and the general structure of the fuzzy system are illustrated.

Fig. 2
figure 2

Proposed Fuzzy Bird Swarm method

The fuzzy system input corresponds to the iterations. To do this, the percentage of the current iteration concerning the total iterations is calculated. It means that when the algorithm commences, the iterations will take a low value and, in this way, it will gradually increase until reaching the point where this almost finished running the algorithm, where the iterations are going to be high or close to 100%. The behavior mentioned above is summarized in the following equation (Melin et al. 2013).

$$ {\text{iteration}} = \frac{{{\text{Current}}\;{\text{iteration}}}}{{{\text{Total }}\;{\text{number}}\;{\text{iterations}}}} $$
(8)

In Fig. 3 the input Iteration is presented, which is granulated with 3 membership functions, using "Low", "Medium" and "High" accordingly as linguistic values.

Fig. 3
figure 3

Input variable Iteration

The output corresponds to the parameters c1 and c2, both are granulated into three membership functions, using “Low”, “Medium” and “High” as linguistic values, respectively. In Fig. 4 and Fig. 5 the fuzzy inference system outputs are presented, respectively.

Fig. 4
figure 4

Output variable c1

Fig. 5
figure 5

Output variable c2

The rules corresponding to fuzzy system number 1, where the values of c1 and c2 are increasing, are presented in Fig. 6.

Fig. 6
figure 6

Rules of fuzzy system 1

In Fig. 7, the rules corresponding to fuzzy system number 2 are listed, in this case, c1 is increasing and c2 is decreasing.

Fig. 7
figure 7

Rules of fuzzy system 2

In Fig. 8, the rules corresponding to fuzzy system number 3 are listed, in this case, c1 is decreasing and c2 is increasing.

Fig. 8
figure 8

Rules of fuzzy system 3

Taking the same parameters and the same linguistic variables, a fuzzy inference system with Gaussian membership functions was created to make a comparison and to be able to study which of them produces better results. In Fig. 9 the Input is presented, while in Figs. 10 and 11 the outputs are presented, respectively.

Fig. 9
figure 9

Input variable iteration with Gaussian membership functions

Fig. 10
figure 10

Output variable c1 with Gaussian membership functions

Fig. 11
figure 11

Output variable c2 with Gaussian membership functions

In the same way as in fuzzy systems with trapezoidal membership functions, the rules were varied, which are presented from Figs. 6, 7, 8.

5 Experiments

Different cases were considered for testing all the proposed fuzzy systems and observing which one produces the best result. For the first case, tests are performed with 10 mathematical functions (7 unimodal and 3 multimodal). To carry out the first set of experiments, the parameters used in the original algorithm are taken, which are presented in Table 1, where it can be observed that the first row corresponds to the BSA and the second row corresponds to the FBSA.

Table 1 Parameters used with BSA and FBSA

The parameters used by the algorithm, and represented in the first row are listed as follows:

M: corresponds to the iterations.

pop: the number of individuals.

dim: the dimension of the problem.

FQ: frequency of bird behavior.

c1 and c2: are the cognitive and social accelerated coefficient, respectively.

a1 and a2: are parameters related to the indirect and direct effect of bird vigilance behavior.

The different mathematical functions that were used are presented in Table 2. The types of functions are presented in the first column. In the third column, the mathematical functions are presented. In columns 4 and 5, their range and their global minimum are presented, which, as we can observe, this set of functions have minima with a value of 0.

Table 2 Benchmark Mathematical problems

For the second case study, experimentation with 10 functions of the CEC2017 was performed, for this case, 50 independent runs are performed for each function and 10 experiments per function. In Table 3 the parameters used in the algorithm are presented.

Table 3 Parameters used in the second case of study

The list of the different mathematical functions of CEC2017 used is presented in Table 4. In the first column, the type of functions is presented; in the second column, the number of each mathematical function is presented. The third column lists the names of the functions, and Fi corresponds to their minimum values and is presented in the fourth column. It should be noted that all these functions have a range of − 100 to 100.

Table 4 CEC2017 benchmark functions

To test the performance of the created fuzzy inference systems, each one was applied to a third case study, which is the optimization of a monolithic neural network. The goal of this artificial neural network was to achieve a system for obtaining the percentage of risk that a person has in developing hypertension over four years.

This neural network is part of a neuro-fuzzy hybrid model (Melin et al. 2018, 2017, 2019; Miramontes et al. 2018b) with which different results related to the blood pressure are obtained; different modules used in the proposed model have been optimized (Miramontes et al. 2018a, 2020a, 2020b; Guzmán et al. 2019; Guzman et al. 2017; Carvajal et al. 2021).

There is a database with information such as age, gender, body mass index, systolic and diastolic blood pressure, if is a smoker, and if has hypertensive parents. They are considered as inputs to the neural network. Once we have this information organized, the FBSA algorithm begins to search for the parameters of the neural network architecture, which gives us a better result. While the neural network is being trained with the given information and learning its behavior, the FBSA changes the architecture of the neural network, in what corresponds to layers and neurons. From previous experience, and having obtained good results, it was decided that the network can have 1–2 hidden layers and 1–30 neurons per layer. In Fig. 12, a representation of the optimization process is presented.

Fig. 12
figure 12

Neural Network Optimization

As an objective function, the FBSA uses the mean square error (MSE), that is, the algorithm will take as the best-found architecture the one that generates the lower error, and the equation is represented as follows:

$$ {\text{MSE}} = \frac{1}{n}\mathop \sum \limits_{i = 1}^{n} \left( {\hat{Y}_{i} - Y_{i} } \right)^{2} $$
(9)

where:

n = number of data points, \(\hat{Y}\)  = the value returned by the model, Y = the actual value for data point i.

6 Results

Table 5 presents the averages of the experiments carried out with the first set of functions. In the first column, the number of the function is indicated, in the second column the results obtained by executing the original algorithm, respecting the parameters given by the author, from the third to the eighth column the experiments carried out with the different variations of the fuzzy are presented. For these mathematical functions, an improvement of the FBSA is observed concerning the original algorithm. However, when comparing the three fuzzy inference systems, it is not observed which one is the best to improve the results of the algorithm, as there is no significant difference among them.

Table 5 Results of the first case of study

The averages of the results obtained when carrying out the different experimentations are presented in Table 6. For this set of mathematical functions, the improvement for the original algorithm is noticeable, the best approach which performs better results is the fuzzy system number 3.

Table 6 Results of the second case of study

Analyzing particularly the experiments carried out with the fuzzy system number 3, it can be observed that in the fuzzy system with triangular membership functions produces better results for 5 mathematical functions, while the fuzzy number one with Gaussian membership functions gives us good results in 3 mathematical functions. Therefore, that fuzzy system 3 with triangular membership functions is the one used for the rest of the experimentation.

In Table 7 the parameters used in the experimentation carried out with the BSA algorithm are presented, it should be remembered that for each experiment the parameters were being varied.

Table 7 Parameters used for BSA in the third case of study

Table 8 presents the parameters used with the FBSA algorithm, and it should be noted here that variables c1 and c2 are dynamic with the help of the fuzzy system.

Table 8 Parameter used by FBSA in the third case study

In Table 9, the errors generated in each experiment are presented, and it can be observed that a minimal error is obtained when using the FBSA compared to the BSA. Regarding the used fuzzy system, it is observed that a better result is obtained with the FBSA that uses the fuzzy system number 3 for parameter adaptation.

Table 9 Errors obtained in the optimization of neural network

On average, the fuzzy system with the least error value was number two with trapezoidal membership functions. In Table 10 the averages of all experiments are presented.

Table 10 Average of the neural network optimization

Once having obtained the best architecture, the experiment is carried out with simulated data of hypertension cases. Table 11 presents the different risk factors and the comparison of the results of the study is made, with the ones obtained by BSA and FBSA, and it can be observed that we are having better results with the FBSA.

Table 11 Simulation with the information of the risk factors

The best neural network architecture that was obtained is defined as:

Number of hidden layers: 2

Neurons in hidden layer 1: 8

Neurons in hidden layer 1: 6

6.1 Statistical test

To compare and verify which of the different methods yields the lowest error, a statistical test is performed, using the Z test, which uses the following expression:

$$ Z = \frac{{\left( {\overline{x}_{1} - \overline{x}_{2} } \right) - \left( {\mu_{1} - \mu_{2} } \right)}}{{\sigma_{{\overline{x}_{1} - \overline{x}_{2} }} }} $$
(10)

where \(\overline{x}_{1} - \overline{x}_{2}\) is the observed difference, \(\mu_{1} - \mu_{2}\) is the expected difference and \(\sigma_{{\overline{x}_{1} - \overline{x}_{2} }}\) is the standard deviation of the differences.

In the experiments of the CEC2017 functions, the null hypothesis states that the results obtained by the FBSA algorithm are greater than or equal to the results obtained by the BSA algorithm. The alternative hypothesis states that the results obtained by the FBSA algorithm are less than the results obtained by the BSA algorithm. Table 12 presents the Statistical Parameters for this problem.

Table 12 Statistical Parameters for FBSA vs BSA

In Table 13, the results of the Z test of all the functions are presented, in the first four columns, the average and standard deviation of the experiments performed with BSA and FBSA are presented, respectively. In column five, the Z value is presented, and in the last column, the evidence is presented. In this case, “S” means the test has significant evidence and “NS” means that the test has not a significant difference. It can be noted that in 9 of the 10 functions the evidence from the statistical test is significant, which means that there is sufficient evidence to support the alternative hypothesis, which is that the results of the FBSA are better than the BSA.

Table 13 Statistical test results for CEC2017 functions

In the neural network experiments, the null hypothesis expresses that the errors obtained by the FBSA algorithm are greater than or equal to the errors obtained by the BSA algorithm. The alternative hypothesis expresses that the errors obtained by the FBSA algorithm are less than the errors obtained by the BSA algorithm. Table 14 illustrates a comparison of the means between the two methods with 30 experiments; it can be observed that the FBSA obtained a lower error compared with the BSA.

Table 14 Comparison results between methods

Table 15 presents the statistical parameters for this test.

Table 15 Statistical Parameters for FBSA vs BSA

Since it is observed that z test statistic value z = − 10.367 is less than the critical value Zc = − 1.64, it is then concluded that the null hypothesis is rejected and the alternative hypothesis is accepted. It can be concluded that there is sufficient evidence with a 5% level of significance to support the claim that the errors obtained by the FBSA algorithm are lower than the errors obtained by the BSA algorithm. In Fig. 13 the probability distribution graph for this test is illustrated.

Fig. 13
figure 13

The plot of the Normal Distribution

6.2 Discussion of results

In this work, the dynamic parameter adaptation to the algorithm called FBSA was applied to mathematical functions and is utilized in a real problem: obtaining the percentage of developing hypertension in the next four years by optimizing a neural network. The objective of making the mentioned adaptation is to improve the performance of BSA to obtain better results, where it is possible to observe a significant improvement when compared to the original algorithm. The results can be observed in Tables 5 and 6 for the mathematical functions and in Table 9 for the case of optimization of the neural network architecture. In the case of the neural network, this is with the best architecture provided by the FBSA, and a simulated dataset of hypertension is used to observe the provided results. When these are compared with the data obtained by the BSA, it is observed that the information provided by the FBSA has higher accuracy since this provides 100% of correct results; this can be verified in Table 11.

The statistical analysis demonstrates that the proposed method is significantly better in 9 of the 10 complex CEC2017 benchmark functions. Similarly, the FBSA optimization of the neural network also obtains sufficient evidence to support that it is better than BSA.

Another experimentation that can be done in the future with the FBSA is to apply it to control problems, in addition to using Interval Type-2 Fuzzy Systems for the parameter adaptation.

7 Conclusion

The dynamic adaptation of parameters of the BSA algorithm is presented in this work, and this was proposed in order to improve the performance of the algorithm. Three different fuzzy systems were designed to carry out the mentioned adaptation, and the difference among the fuzzy systems was in the rules. After analysis, it was decided to make dynamic the parameters corresponding to the cognitive and social acceleration coefficients, respectively (c1, c2). Because when varying these parameters, the variation and improvement in the results is observed.

Three different case studies were considered to determine if a better result is obtained than the original algorithm and to find out which of the 3 proposed fuzzy systems achieves the best result. In the first case study, which was to experiment with 10 traditional benchmark mathematical functions, it can be observed that, there was an improvement in the results with the FBSA algorithm against the BSA. However, in this case a decision could not be made in which of the applied fuzzy systems was better, since the observed results were similar.

In case study number two, which was tested with 10 CEC 2017 functions, it was also observed that the FBSA provides better results. In this case, it can be concluded that for the solution of this problem the fuzzy system number 3, which uses decreasing rules and triangular membership functions provides the best result. In the last case study, which consisted of optimizing a neural network architecture to obtain the risk of developing hypertension over four years, a considerable improvement was also noted. When the methods were statistically tested, it can be observed that there is significant evidence to be able to affirm that the FBSA algorithm gives us better results. We can conclude that when performing dynamic adaptation of parameters to the BSA algorithm, a significant improvement in the results is obtained. In future work, we plan in applying the dynamic adaptation of parameters with Interval Type-2 Fuzzy System.