{'fraction_non_alphanumeric': 0.03277759410570066, 'fraction_numerical': 0.010390591791432485, 'mean_word_length': 4.959470869687588, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
FLC control for tuning exploration phase in bio-inspired metaheuristic

Growing popularity of the Bat Algorithm has encouraged researchers to focus their work on its further improvements. Most work has been done within the area of hybridization of Bat Algorithm with other metaheuristics or local search methods. Unfortunately, most of these modifications not only improves the quality of obtained solutions, but also increases the number of control parameters that are needed to be set in order to obtain solutions of expected quality. This makes such solutions quite impractical. What more, there is no clear indication what these parameters do in term of a search process. In this paper authors are trying to incorporate Mamdani type Fuzzy Logic Controller (FLC) to tackle some of these mentioned shortcomings by using the FLC to control the exploration phase of a bio-inspired metaheuristic. FLC also allows us to incorporate expert knowledge about the problem at hand and define expected behaviors of system – here process of searching in multidimensional search space by modeling the process of bats hunting for their prey.


I. INTRODUCTION
In general metaheuristics algorithms can be divided into few groups, e.g. algorithms based on evolutionary approach that models evolutionary process or algorithms exploring phenomena of a Swarm Intelligence [1]. Others approach for evolutionary metaheuristic, such as algorithms for modeling response of a human immune system (e.g. Artificial Immune System algorithms) might be considered as separate category due to their multiplicity of proposed solutions.
Metaheuristics methods which are focused on exploring models of a natural evolution are (mostly but not limited to) as follows: Genetic Algorithms (GA) [2], Genetic Programming (GP) and Differential Evolution (DE) [3]. Algorithms based on Swarm Intelligence are broadly presented by Particle Swarm Optimization (PSO) [4], Ant Colony Optimization (ACO) [5] or some of its modifications.
Recently introduced method, based on population of solutions which explore phenomena of Swarm Intelligence was presented by Yang [6] in 2010 and it is called Bat Algorithm (BA). In [6] by modeling the behavior of bats hunting for prey and by exploring phenomena of their echolocation capabilities, author managed to incorporate methods for balancing the exploration phase as well as exploitation phase of a modern Swarm Based Algorithms.
Bat Algorithms had already been applied to solve numerous hard optimization problems such as multi-criteria optimization [7] or optimization of topology of microelectronic circuits [8].
Growing popularity of the Bat Algorithm has encouraged researchers to focus their work on its further improvements. Most work has been done within the area of hybridization of Bat Algorithm with other metaheuristics or local search methods [9]. Some other solutions were involved within the area of adding self-adaptability capabilities to algorithm [10]. Some works has also been in area of adaptation of standard Bat Algorithm for binary problems [11].
Unfortunately, most of these modifications not only improves the quality of obtained solutions, but also increases the number of control parameters that are needed to be set to obtain solutions of expected quality. This makes such solutions quite impractical.
This paper introduces fuzzy logic control system build on Mamdami-Type inference method to control the exploration and exploitation phase of an evolutionary system based on modified Bat Algorithm [12]. Application of fuzzy logic to control the exploration and exploitation phase frees the user from explicit specifying control parameters and only require to define expected behavior of an algorithm in human readable knowledge base form of if-then sentence.
Paper is organized as follows, in Section 2 basic scheme of the Bat Algorithm and some custom modifications are introduced and briefly discussed, Section 3 discuss the use of a fuzzy inference system to dynamically change algorithm parameters, Section 4 presents simulation experiments. Section 5 summarize presented results and discuss some concluding remarks.

II. BAT ALGORITHM AND ITS MODIFICATION
Bat Algorithm is recently proposed bio-inspired metaheuristics method for solving hard real valued optimization tasks. It tries to mimic behavior of bats hunting for their prey. Algorithm was introduced by Yang in 2010 [6]. Bat Algorithm is based on population of bats, which by flying thru solution search space explore it in order to find interesting areas. Each single bat represents one solution in n-dimensional search space. Solutions are evaluated in terms of their fit value by provided fit function.
For example, we can consider n-dimensional, real valued solution space in which optimization takes place. Each solution, represented as a bat, is evaluated with provided fit function. There are also two real valued n-dimensional vectors associated with each bat in population. First vector is real valued vector representing position of a bat in solution search space. Second vector is real valued vector representing velocity in each of ndimensional directions. Usually position vector and velocity vector are initialized randomly at the beginning of the algorithm. Main loop of the algorithm consists of iterative improvement in founded solution. At each iteration step fit value is calculated for every member of population of bats by provided fit function, and new velocity vector is calculated based on relative distance from best and current solution in population. Next, position of every bat is updated accordingly to its velocity vector. At the end of each iteration best solution is founded and used as new reference point. Exploring search space continues until some termination conditions are satisfied. Usually these conditions are the maximum number of iterations or improvements in the best solution. As a result, after satisfied stop conditions, the best solution is returned. Pseudo code for Bat Algorithm is listed in Fig.1.

A. Modification to Bat Algorithm
An important aspect of a population-based metaheuristic is balance between exploration and exploitation phase of a search process. Exploration (sometimes called diversification) is responsible for global search capability. While, in contrast, exploitation (sometimes called intensification) is responsible for local search ability of algorithm. As it was pointed out in [13] Bat algorithm is powerful at exploitation but has some insufficiency at exploration phase. In our opinion Bat Algorithm also suffer from lack of memory of best solution found during the time of optimization what in effect sometimes cause bats to escape from promising area of solutions search space. Bat Algorithm also tends to direct bats outside of the solution search space box. Yang in [6] proposed to use upper bound limits on position vector to overcome these limitations. Bat Algorithm also too often tends to accept solution of worse fit value.
Few modifications to Bat Algorithm has been proposed in literature. In [14] Inertia Weight Factor Modification relative to current iteration and max iteration and Adaptive Frequency Modification based on relative bat distance to best solution has been introduced. In [15] dynamic and adaptively adjustment of a bat speed and flight direction has been examined. Self-adaptive capability has also been examined in [10].
Bat Algorithm has also been hybridized with Harmony Search Algorithm [13] or with Differential Evaluation Algorithm [9]. In [16] Bat Algorithm with self-adaptation of control parameters has been hybridized with different DE strategies as local search heuristics. However there are no systematic solutions to previously mentioned problem hence proposed modifications.
Modifications to Bat Algorithm introduced by Kiełkowicz and Grela in [12] are twofold: scheme of acceptance of a new solution, and velocity equation is modified to overcome some mentioned limitation. Introduced modifications are summarized in pseudo code listing in Fig.2. Memory of best solution found during the process of optimization by the algorithm is also introduced.

1:
Randomly initialize position and velocity of i-th bat in population 2: Initialize pulsation frequency ∈ [ , ], pulsation and loudness of i-th bat in population 3: while not termination conditions are satisfied: Q=fuzzyInferenceSystem(diversity, error, iteration) 4: for_each bat in population: 5: if randn(0,1) > : ′ ← generate new solution around current bat 7: if ( ′ ) < ( ) or randn(0,1) < : ← ′ Update values of pulsation and loudness, respectively and as: +1 ← ; +1 ← (1 − exp (− )) 8: Evaluate bats population using fit function 9: 10: Find best bat in population and mark him as * if ( * ) < ( * ): 11: * ← * Modifications introduced in [12] also change bat position and velocity update equations. In comparison with equations presented in [6], use of an archive component to help direct bats towards area where good solutions were used to be known; and concept of cognition coefficients instead of using upper bounds limits is used in [12]. Finally, equations (1) and (2) shows introduced modification: In comparison to equations proposed by Yang in [6] modified velocity equation (1) is using cognition coefficients to limit the influence of past direction (taken at time t-1) at the decision taken at current t iteration. There is also archive component that helps bats build social knowledge of the previously, globally found best solution.
Proposed modification to the scheme of acceptance of new solutions are tend to limit the probability of acceptance of worse solution. Comparing original Bat Algorithm with modification in [12] the worse solution is accepted with probability where in modified algorithm worse solution is accepted only with probability (1 − ) . There is obvious relation that, satisfying that > 0 and > 0, the following relation is true (1 − ) < . Moreover, modifications introduced in [12] also includes form of memory * of a best solution ever found.
It is important that introduced modifications doesn't change computation complexity of the algorithm in the context of big  notation since these modifications are linear in nature and are not based on additional computation or evaluation of a fitness function.

III. PARAMETER ADAPTATION WITH FUZZY LOGIC
The dynamic of Modified Bat Algorithm is defined by position and velocity update equations (1) and (2). Pulsation frequency was chosen to be adjusted using fuzzy logic Mamdami-Type inference type system since this parameter has an influence on the movement of bats in the flock. Dynamical changes of parameter can improve overall performance of algorithm. However, it is not always possible to derive clear mathematical formula describing how parameters should be adopted during optimization process. However it is easier to describe expected behavior of an algorithm in form of an if-then sentence describing situation and expected behavior, e.g.: "If iteration is small, then explore is intensive" or "if diversity is small and iteration is big, then explore is less".
The goal of these paper is to explore possibility of using fuzzy logic Mamdami-Type inference system to control exploration/exploitation phase of a Bat Algorithm. To build Mamdami-Type inference system it is required to: define input values (and their fuzzification methods), define linguistic variable and knowledge base in form of an if-then sentence and define output values (and their defuzzification method). In these paper as it was introduced in [17] we also use diversity of the flock, the error of the flock and the iterations themselves as input parameters. As our output parameter, we choose . We expect our input and output parameters to be in [0, 1].
The diversity (dispersion) of the flock is defined by following equation (3):

 
It can be considered as an average Euclidean distance between each bat and bat representing best solution at the i-th iteration. Diversity measure degree of dispersion in the flock. When bats are close to each other the diversity is small. Diversity to be considered as input to fuzzy inference system needs to be normalized before, since input must be in [0, 1]. Equation (4) was used to normalize diversity: The error of the flock measures the difference between the flock and the best bat, by averaging the difference between the fitness of each bat and the fitness of the best bat. It is defined by following equation (5): Error in the flock to be considered as input to fuzzy inference system needs to be normalized, since we expect it to be in [0, 1]. Equation (6)  From now on normalizedDiversity(t) and normalizedError(t) will be referred simply as diversity(t) and error(t) respectively and as .
For iteration to be considered as input to fuzzy logic inference system it needs to be normalized, we used formula (7): Knowledge base for Mamdami-Type inference is in form of a set of an if-then sentence, where if part is a premise and then part is conclusion. Each sentence is constructed using linguistic variables and (possibly) "and/or" connectors and hedges. In these paper, we consider three linguistic variables diversity, error and iteration as input to inference system and one output linguistic variable Q.

IV. SIMULATION EXPERIMENTS
To examine how exploration and exploitation phase can be controlled with fuzzy logic controller in bio-inspired metaheuristic few simulation experiments were performed.
Parameters of the algorithm were dynamically controlled by fuzzy Mamdami-Type inference system. First, we examine how exploration and exploitation can be controlled with knowledgebase and different input linguistic variable. It was done by examining how diversity in the flock change over time. More diversity means algorithm is in exploration phase, where less diversity in the flock can be determined as exploitation phase. To reduce influence of local search (line 7, algorithm 2) during experiments no local search ( = 1) was conducted. Simulations were performed on well-known test functions, with computer running on Intel Core i5 class processor, with 8GB of RAM. Algorithm has been implemented in Java, using FuzzyLite [18] library. Section IV.A briefly introduce used test functions, section IV.B reports obtained results.

A. Test Functions
Experiments were performed on three well known and wildly accepted test function for continues real-valued optimization problems. Used test functions are: Sphere, Rastrigin and Rosenbrock [16]. In every equation, D will stand for dimension of the function and ⃗ is real valued vector in search space, ⃗ ∈ ℛ .
First function was standard test function called Sphere. It is convex, unimodal simple test function for metaheuristics (8), with global solution at the point ⃗ = (0, 0, … ,0).
Second function was Rastrigin's function. It is based on Sphere function (8) by adding sinusoidal modulation what results as Rastrigin function (9). It is multimodal non-linear function with global minimum at point ⃗ = (0,0, … ,0).
Last was Rosenbrock's function (10) which has its global solution at point ⃗ = (0,0, … ,0). Rosenbrock's solution is located in wide parabolic shaped valley. This makes it very complicated point to reach by evolutionary methods. Rosenbrock function is unimodal for D=2,3 while it is multimodal for more dimensions [19]

B. Experiments
To examine how exploration and exploitation phase can be affected by knowledge-base of the inference system and input variable we execute our algorithm on different test function with different knowledge-base, each time starting from the same initial population for one test function. Each time diversity and average population fit at iteration were reported.
Input linguistic variable iteration, diversity and error were defined accordingly with terms {big, small} as depicted in Fig.3 KB1:= "if iteration is small then Q is big", "if iteration is big then Q is small" KB2:= "if iteration is small then Q is small", "if iteration is big then Q is big" KB3:= "if iteration is small or diversity is small then Q is big", "if iteration is big or diversity is big then Q is small" KB4:= "if diversity is small or error is small then Q is big", "if diversity is big or error is big then Q is small" Corresponding control surface are depicted on Fig. 7. During the experiments, standard max function was chosen as "or" operator and Centroid method was chosen as defuzzification.
Results for Rastrigin function are presented in Fig.8-11.    Results for Sphere function are presented in Fig.16-19.    Analyzing figures 8, 12, 16 that shows influence of knowledge-base KB1 on tested function let us see that flock, as iteration times go, tend to fly closer together. That behavior is coherent with our intuitive analysis and understanding of KB. KB1:= "if iteration is small then Q is big", "if iteration is big then Q is small" Analyzing figures 9, 13, 17 that shows effect of KB2 on the flock, opposite tendencies can be seen. Here, as iteration times go, diversity gets bigger. This kind of behavior is also coherent with our intuition on how KB might affect the flock.
KB2:= "if iteration is small then Q is small", "if iteration is big then Q is big" Figures 10,14,18 and 11,15,19 shows how KB3 and KB4 respectively affect the diversity as iteration time goes.
KB3:= "if iteration is small or diversity is small then Q is big", "if iteration is big or diversity is big then Q is small" KB4:= "if diversity is small or error is small then Q is big", "if diversity is big or error is big then Q is small" KB3 and KB4 tends to increase diversity in the flock as algorithm getting closer to stop criteria (max. iterations). To verify how considered knowledge-base KB1, KB2, KB3 and KB4 affect algorithm capability to find solution and how they affect mean solution (and standard deviation of solutions) algorithm was rerun 50 times for each knowledge-base. Each time starting points (bats locations and their velocities) were initialized randomly (with unit distribution) within search space. Simulations were performed for Sphere, Rastrigin and Rosenbrock function in D=25-dimensional real valued cube with limitation [-10, 10] on each side. For each test 100 bats were used, no local search ( = 1) were performed during experiments. Termination condition was set to 1000 iteration. Obtained results are reported in Table 1 and 2. Analyzing Table 1 and 2 it can be seen that KB1 generate solutions with less standard deviation within, where solutions found using KB2 vary from another. The biggest diversity in reported solutions were generated by KB3.

V. CONCLUSIONS
This paper examines usage of a Knowledge-base Mamdami-Type inference system to dynamically modify configuration parameters of a bio-inspired metaheuristic. Four Knowledgebase build using standard if-then sentence were considered and their effect on exploration and exploitation phase of the modified Bat Algorithm has been tested. This paper considers three linguistic variables as input: diversity, error and iteration in the flock to fuzzy inference system and one linguistic output Q. Each linguistic variable can take {small, big} as linguistic variable. Input and output linguistic variable are defined as fuzzy sets, with membership functions depicted as it is shown in Figures 3, 4, 5 and 6. Four different knowledge-base are considered and corresponding control surface is shown in Figure  7. Three well known and wildly accepted test function for continues real-valued optimization problems has been used to test how algorithm behave under different Knowledge-base. Used test functions are Sphere, Rastrigin and Rosenbrock [15]. Simulation experiments shows that it is possible to incorporate expert knowledge about the problem at hand and define expected behaviors of system in form of an if-then sentence. For example, if operator want (or need) algorithm to have exploration phase at the beginning and exploitation at the end, can use KB1. Figure 8, 12 and 16 depict how diversity of the flock (found solutions) changes during iteration under KB1. For each different test function (Rastrigin, Rosenbrock, Sphere) similar behavior can be observed. Initially (iteration is small) there is big changes in diversity of the solutions poolwhich reflect exploration phase of an algorithm. As iteration times goes (iteration is big) diversity getting smalleralgorithm starts exploitation phase. Analyzing Table I and II with statistical properties of an algorithm (obtained after 50 rerun of an algorithm starting with different randomly initialed population), it can be seen that when search process is controlled with KB1 there is a less deviation in found solution than using KB2. It can be explained that KB1, as times goes, emphasize exploitation phase of a search process, where KB2, as times goes, emphasize exploration phasehence bigger deviation within found solutions. Similar analysis can be conducted for KB3 and KB4 where algorithm dynamically change emphasizes of exploration or exploitation phase -back and for-during search process as needed accordingly to provided knowledge-base.