Approach for solving multimodal problems using Genetic Algorithms with Grouped into Species optimized with Predator-Prey

-6Abstract —Over recent years, Genetic Algorithms have proven to be an appropriate tool for solving certain problems. However, it does not matter if the search space has several valid solutions, as their classic approach is insufficient. To this end, the idea of dividing the individuals into species has been successfully raised. However, this solution is not free of drawbacks, such as the emergence of redundant species, overlapping or performance degradation by significantly increasing the number of individuals to be evaluated. This paper presents the implementation of a method based on the predator-prey technique, with the aim of providing a solution to the problem, as well as a number of examples to prove its effectiveness.


I. INTRODUCTION
n the Genetic Algorithms [1] there is a simulation of a population of individuals that evolves until reaching a solution within a given search space. With the aim of achieving various solutions in a multimodal environment, that is, with several optimal valid values, a division of the population into species is carried out, so that each can specialize in a solution of the problem. Using this technique, the obtained results were satisfactory [2]. However, it has some drawbacks. Due to the fact that new species are created with each generation, and therefore new individuals, the population grows exponentially. The immediate consequences are an increased consumption of computational resources, as well as a slowing down of the whole system.
To avoid the created drawbacks, the concept of predatorprey [3] is introduced in the system applying it to species in the area. The technique is firstly designed to distribute individuals behaving as prey randomly in an area and then do the same with some individuals called predators, which, according to some rules, deal with deleting some of the prey in the neighborhood. The deleted individual is replaced by another, obtained as a result of a mutation of a randomly chosen nearby prey and predators move around, looking for a new victim.
This technique could be used in a similar way when dealing with grouping into species, so that species could compete against each other, as preys or predators, according to some previously defined rules. The role is assigned dynamically, after the meeting of the two species. In the same way, the species which enhances the values of the chosen rule is helped to continue its evolution, whereas the individuals of the other species disappear. The species and individuals that are considered dispensable for obtaining solutions will be removed from the system.
The predator-prey method is aimed at overcoming the limitations that arise when applying the technique of the Genetic Algorithms grouped into species to a multimodal problem, obtaining the best results provided by the grouping of species, but using the fewest elements possible, so that the species could maintain their numbers or even suffer losses during the development of the method and as a result the total amount of individuals decreases. Hence, the method implementation is optimized.
A first approximation is performed to test the system using a multimodal Rastrigin function. This is a preliminary study whose aim will be to apply the solution to complex problems.

II. MULTIMODAL PROBLEMS
Multimodal problems are problems with multiple local optima and/or multiple global optima. In the real world, we usually wish to know the largest possible number of solutions to a problem. This may be due to various factors. On the one hand, we may not have total knowledge of the problem and when we find a solution, we may ignore how good it really is because we cannot be certain that no better solutions are available in our search space. On the other hand, we may know that our solution is the best response to a problem, but other solutions turn out to be better in global terms because they are

III. GENETIC ALGORITHMS
Genetic Algorithms are adaptive methods that are generally applied to the search and optimization of parameters and based on "sexual" reproduction and the survival of the most apt specimen. Following the schemes proposed by C. Darwin [4], an initial set of individuals or "population" is created, who evolve in the course of several generations, each individual representing the solution to a problem. After several evolutions, the best individuals are maintained, but so are other specimens of less quality, in order to respect diversity and guarantee the existence of individuals with diverse features that may adapt to possible changes in the environment.

1) Origins and Biological Bases of Genetics Algorithms
In nature, the most adapted individuals have the best chances to reproduce themselves. Genetic inheritance provides descendants with the features of the most adapted progenitors and allows the species to evolve. Evolutionary Computation arises when researchers try to emulate the good results for problem solving offered by nature and is based on certain facts of biological evolution with strong experimental evidence:  Evolution takes place in the chromosomes, not in the individuals.  Natural selection is the tool that relates chromosomes to their efficiency. The most efficient individuals have more possibilities to reproduce themselves.  Evolutionary processes take place in the reproductive stage (even though some aspects, such as mutation, may occur in other stages). Traditional Genetic Algorithms do not contemplate the possibility of dividing individuals into species in order to reach solutions. This article proposes to open up this behaviour.

2) Classification of Genetic Algorithms
There are several ways of classifying Genetic Algorithms. The most common solution consists in classifying them according to the obtaining of new generations, which leads to the following categories:  Generational Genetic Algorithms: the parent generation is eliminated in the course of the last reproductive phase, and only the new population is maintained.  Steady-state Genetic Algorithms: the parents of one generation coexist with the children of the next generation. Population substitution algorithms are used to determine who must be eliminated.  Another classification of Genetic Algorithms focuses on methods of execution:  Sequential Genetic Algorithms: This is the usual way of executing an algorithm: one population tries to solve a problem by crossing its individuals over several generations and evolving towards a solution.  Parallel Genetic Algorithms: In nature, when populations are geographically isolated from each other, they tend to evolve and originate different responses to evolutionary pressure. This originates two models that use multiple populations concurrently: the Island model and the Cellular Model [8]. In the Island Model the population of individuals is divided into subpopulations that evolve separately, like a normal Genetic Algorithm. In the Cellular Model each individual is placed in a matrix where it can only reproduce itself with the individuals that surround it, choosing at random or picking those that are most adapted.
3) Problem codification Any potential solution for a problem can be presented by giving values to a series of parameters. All these parameters (genes in the Genetic Algorithms terminology) are codified into a chain of values called chromosome. This codification tends to be carried out, if possible, with binary values, although real and entire values are also used. Each bit that belongs to a gene is called allele.

4) Main Algorithm
The generic functioning of a sequential generational Genetic Algorithm is the following one: Initiate current population arbitrarily WHILE the termination criterium is not fulfilled create empty temporary population WHILE temporary population does not fulfil select parents cross parents with probabilty Pc IF crossing has ocurred -Mutate one of the descendants with probability Pm -evaluate descendants -add descendant to the temporary population OTHERWISE -add parents to the temporary population END IF END WHILE increase generations counter establish the temporary population as new current population END WHILE The pseudocode of a steady-state Genetic Algorithm would be similar to the above, except that the temporary population would be absent and we would have to use substitution algorithms.
One generation is created from a previous generation by means of two types of reproduction operators: cross-over and copy. Cross-over is a sexual reproduction that originates new descendants by exchanging the genetic information of the parents; copy consists in passing a certain number of individuals to the next generation without any variation. Once the new individuals are generated, mutation takes place with a Pm probability, and the errors of the genetic copy process are imitated.
The process finishes when there are sufficiently good solutions in the shape of better individuals, when all the individuals converge towards a similar value, or when the largest possible number of generations is reached.
In order for a Genetic Algorithm to function correctly, it must dispose of a method that indicates whether or not the individuals of the population represent good solutions to a given problem. This is the task of the evaluation function, which establishes a numeric measurement of the quality of a solution. This measurement is called adjustment or fitness.

ALGORITHMS
The Genetic Algorithm-based approach is able to obtain a good approximation to the solution of the problem to be solved within a few generations. However, the tendency of finding a single solution becomes a disadvantage when dealing with multimodal problems, since in such cases it is preferred to find several solutions.
One of the options to try to solve this drawback involves using the technique of grouping into species which, broadly speaking consists of grouping the initial population of individuals into classes with similar characteristics [2]. Hence, the aim is that each group will be specialized in a particular area of search space. Thus, each species will tend to find an existing solution in its area, other than those provided by other species. This is an attempt of modeling the species distribution of individuals in the natural environment, and their evolution separately. For example, there are individuals adapted to live in cold areas, others in dry or hot ones, etc. Each group manages life in a given environment, adapting to this end specific characteristics that differentiate it from the other groups.
However, this technique has its drawbacks. Thus, certain conditions are required for proper operation, conditions which are not usually obtained in the initial distribution of the problem. For example, it would be recommended that the population should be evenly distributed throughout the search space, and moreover, that groups should be well distributed and in accordance with the number of solutions to the problem. If there are no such characteristics, there may be unexplored areas in contrast to others that are highly explored and in which, depending on how the groups are formed, several species can coexist.
To overcome these drawbacks, we use the crossing of individuals from different species through several generations. In doing so, the offspring resulting from these crosses mix knowledge of their predecessors' species and there emerges the possibility of creating a new species in an area different from their parents'. In this way, stagnation of species is avoided, new areas are explored and new knowledge emerges, that is, diversity is achieved in the environment. Once again, individuals' behavior is being modeled in their natural environment, whereas migration or expulsion of individuals takes place and if they find compatible individuals of other groups, they end up creating new species.
For the implementation of these techniques an initial population is created. The overall process -starting from creating the initial population -is to carry out successive iterations in which the following steps are required: One of the main criteria is to check whether the number of iterations, also called evolutions, reaches the maximum number allowed; another is to check whether the population reaches its upper bound of individuals. If either of these conditions is met, the implementation of the algorithm is concluded. Another possible break criterion is that the error value of individuals had fallen below a threshold set in advance.
For the second step of the algorithm, there is no standard way to divide the population of the Genetic Algorithms into species. To solve this problem, techniques of unsupervised grouping of individuals are employed, as there is no a priori knowledge but simply an input data set. The classification is carried out according to some specific parameters of each grouping algorithm type. Two of these techniques that could be used are the Adaptive Method [5], which is a simple and efficient incremental heuristic method using only two parameters and Batchelor and Wilkins' algorithm or the Maximum Distance algorithm [6]. In this case, we also deal with an incremental heuristic method, but it uses a single parameter. Biologically, predation occurs when one of the animals (the predator) devours another living animal (the prey) to use the energy and nutrients in the body of the prey for growth, maintenance or reproduction. Using the predator-prey idea, a model was proposed, adapting the predator-prey concept to Genetic Algorithms [7].
There are software projects dedicated to designing and analyzing predator-prey models. One of them is PEPPA [8], which is a framework for such purpose. The user can work with different operating environments as well as set up the predators' behavior and preys' adaptability. In addition, PEP0050A provides tools for visualization and parallelization of the program running.
The original operation consists of the fact that each individual representing a solution in the genetic population plays the role of prey and of the fact that other individuals in the system play the role of predators, choosing their prey according to the objective function and the fitness of each prey. The method imitates the natural phenomenon in which a predator eliminates the weaker prey, which means that a predator eliminates the most unfit individual in the environment, which corresponds to the worst value obtained in such individuals with the objective function.
To implement this idea a network was proposed, in which the prey are randomly distributed at each node and wherein one or more predators are also placed randomly at some of the nodes.
From that moment, each predator evaluates all prey in its area and deletes the prey corresponding to the worst objective value. Then, a nearby prey is chosen and mutated. The mutated individual replaces the deleted prey and the predator moves to one of the neighboring nodes. This procedure is followed for all predators. As follows, a diagram is shown in Figure 2 [11] presenting the network created with prey and predators.

Fig. 2. Representation of prey and predators
The use of this method is widely associated with the multiobjective Genetic Algorithms [9]. These are Genetic Algorithms which are aimed at finding solutions that optimize several objective functions simultaneously. In such a case, one or more predators are created for each of the objective functions involved; or even a predator that takes into account several objective functions involved in the system is created. The initial diagram regarding the operation of the classical algorithm of the predator-prey approach had already taken this aspect into account. Although modifications and optimizations have been made since its inception, the diagram we have broadly followed is classical [3], as detailed below.

Fig. 3. Operation diagram of the predator-prey approach
The break criterion is either a maximum number of generations or the fact that the objective functions to be optimized have an error below a certain threshold.
Several set-up changes can be performed, as using more predators for every objective function, mutate the best neighbor after predation or move the predator to the box of the best neighbor, instead of moving it randomly. In some cases [9], the outcome of the overall population is improved.

VI. PREDATOR-PREY APPLICATION IN GENETIC ALGORITHMS WITH GROUPING INTO SPECIES
In spite of the fact that the Genetic Algorithms provide optimal solutions to many problems, they have some Predator Prey drawbacks when used to find several solutions in scenarios with multiple optimal points. With the aim of trying to overcome these drawbacks, other solutions were searched for. Among these solutions we mention the grouping the population of individuals into species. However, it is verifiable that, in the implementations of grouping into species carried out, there are some drawbacks which arise due to the fact that both the number of species and number of individuals tend to continue to grow indefinitely throughout the different evolutions [2]. Such an increased number of individuals and species leads to a continuous increase of the necessary computational resources.
In order to optimize the number of elements used in computing, we suggest applying the benefits of the predatorprey approach to the system made up of Genetic Algorithms grouped into species. This new system is aimed at reducing the number of elements involved in computing, allowing the predation of individuals and, if the choice of which ones should be deleted is made correctly, maintaining similar results to those obtained without the predator-prey approach.
In order to apply the predator-prey approach to the developed system, some changes are necessary, using the main idea of the method as base. Thus, the elements involved are as follows:  Space for action. This refers to the search space itself, where individuals are distributed.  Prey. Any species in the system can become prey, being devoured by a predator, which would mean the removal of the species and individuals within it.  Predator. Any species in the system can become predatory. A prey species devours other prey species. As a benefit, individuals of the species that devours, as well as the species itself, will be able to continue to evolve.  Objective Function. In this approach, the system will use only the objective function that the Genetic Algorithm employs in each case to calculate the fitness of individuals if necessary.  Interaction criterion. While in the classical predatorprey algorithm the predator devoured the worst prey in the neighborhood, in this case we need to know the criterion involved so that a species can try to devour another. An example in this sense would be when the species is close enough to the area of another species.  Role determination criterion. Besides the classical players of the predator-prey approach, it is necessary to define a new concept, the winning rules. In the classical algorithm, some individuals behaved as prey and others as predators. In this case, the same entitya speciescan behave as predator on some occasions and as prey on others. It is necessary, therefore, to define a rule specifying, when appropriate, which of the species will behave as predator and which as prey, and therefore to know which species will survive (predator) and which will be deleted (prey). To this end, the concept of role determination criterion is defined. The role determination criterion refers to a series of algorithms by which it is decided which species would behave as predator and which as prey. The direct consequence is that the predator species will devour the prey species, the latter disappearing from the system. An example in this regard would be that the predator species (and therefore the survivor) is the one whose individual has the best possible fitness. The general operation is described below. Once the grouping of individuals into species is performed, and before applying the Genetic Algorithm to each of them, the predatorprey algorithm is applied as follows. The flow chart of the method is detailed in Figure 4. As shown, two species are chosen from the set created by grouping into species. Then, the interaction criterion is applied. If the species meet the criterion so that the predatorprey approach could be applied, we continue with the next step; otherwise, we should check again whether there are still species that do not meet the interaction criterion. If the species interact, the next step is to apply the role determination criterion to see the role each species assumes, predator or prey. Finally, the predator species is maintained and the prey species is deleted. Individuals belonging to the prey species are marked for removal. The process is repeated until there are no more species that could compete with each other.
To be able to work with this approach, a type of rules should be defined. There will be a more in depth discussion on interaction criterion, providing some examples to decide when two species should behave as predator and prey, and on role determination criterion to indicate how the decision is made NO regarding which species should be prey and which predator.

1) Examples Interaction criteria.
By grouping the individuals of the population into species, it is not known whether they should interact so that one becomes a prey and the other predator. Thus, the interaction criteria are used to decide when two species in the environment should establish a predator-prey relationship.
If the interaction criterion implemented for two species in the environment decides which species behave as predator and prey, we continue with the next step where it is decided which will behave as prey and which as predator. If the criterion is not met, the search is continued among the total number of species, until finding a pair to which the interaction criterion has not been applied yet. If there is no such pair of species, the proceedings will be completed.
An example of interaction criterion is making two species face each other if the distance between them is below a certain threshold.
In order to observe an example of interaction criterion of distance between species, a hypothetical scenario is shown in Figure 5, where a decision is made regarding which species will interact with the "E1" specie. With a threshold value of 5, only the "E3" specie is below the threshold, so this would be the only species that E1interacts with.

2) Examples Role determination criteria.
Unlike the original algorithm of the predator-prey approach in which the roles of individuals are static, as there are prey and predators from the beginning in the system and there will be as long as they are used, in this case we are dealing with a dynamic allocation, since any species can behave as prey or predator.
A role determination criterion is an algorithm that decides which of the two interacting species survives and behaves as a predator and which one behaves as prey and is therefore deleted. These rules can be usually generalized to any number of species.
A possible Role Determination Criterion is that of the Best Individual. Using this criterion, the winner is the species that has the best individual out of the two species. This rule could be generalized to choose a predator from any number of species. In Figure 6 it is shown an example where the species with the best individual is the predator and the one with the worst individual is the prey, being thus deleted. In this example, the greater is the fitness of the individual, the better it is. E3 is the predator specie. To check the performance of the predator-prey approach, we use a Genetic Algorithm with Grouping into Species and the corresponding algorithms of the method are applied throughout each evolution.
Before starting the application, we need on the one hand to choose the problem to be solved and on the other hand, considering the problem in question, to select the parameters to be used both to group the individuals into species and for the Genetic Algorithm to be applied to each species in each evolution step. The values selected are in the Figure 7.

FEATURES GENETIC ALGORITHM Parameter Value
Algorithm Selection 1/ Algorithm Selection 2

Roulette-wheel/ Arbitrary
Cross-over algorithm Hence for a first approximation, the Rastrigin function [10] is chosen, which is widely used to show the effectiveness and study of the multimodal problem solving methods. This is a function that has many local minimum and maximum values. In this test are sought maximums. In Figure 8 it is shown a 3D representation of the Rastrigin function. As observed, it has many local maximum values (shown in red) and minimum values (shown in blue).

Fig. 8. 3D Representation of the Rastrigin Function
To work with the predator-prey approach, the values previously used in the Genetic Algorithm as well as the Grouping one are set. These are values that obtain satisfactory results in the system of Genetic Algorithms with Grouping into Species. Once set, we compare the results obtained when using or not using the predator-prey approach.
To show the results of applying the predator-prey approach, we implement the distance between species as interaction criterion and the best individual as role determination criterion. The results are compared to those obtained after running the system without using this method.
Once implemented the predator-prey system, it is run. Are only required 10 evolutions to show good results. As follows we present the solutions in the contour plot of the Rastrigin function. The red dots represent the best individuals of each species (the individuals with the least error). Red and green contours are maximum. To obtaining such results, practically identical to those obtained without applying the predator-prey approach, it was necessary to employ a number of species and individuals at all times lower than those employed in the execution without the predator-prey approach, as shown in Figure 7. It is noted that in this case the trend in the number of individuals is increasing, but to a much lesser extent than when the method is not used, since in this case there are deletions of entire species. In Figure  10, we can see the decrease in the number of species and individuals throughout the various evolutions after using the predator-prey approach and in Figure 11 the error evolution.  11. Evolution of the error and of the best individual's error Note that the error persists, and the number of individuals and species is much lower, decreasing approximately 40%. The number of solutions reached in this case is slightly lower than in the case of not using the predator-prey approach.
Therefore, the objectives of reducing the number of species and individuals under study are fulfilled, maintaining the error and optimizing the number of necessary resources. Similarly, we found a large number of solutions in any of the two executed cases, approaching to the one found without applying the predator-prey approach.

VIII. CONCLUSION
The tests conducted showed that efficiency Genetic Algorithm with Grouping into Species for multimodal problems was improved. Only a few evolutions were necessary to verify the benefits of the application of predator-prey.
In general, the results were maintained or even improved since species in which individuals did not provide good solutions and increased the error were deleted of the environment.
After checking the adequacy of the proposed solution, the next step would consist of implementing new role determination and interaction criteria that should be more appropriate for a specific problem.
In addition, in each interaction there is a prey species and a predator species. This could be extrapolated, so that there could be an interaction with several preys and/or several predators, as well as a number of objective functions to be optimized, using them for selecting prey or predators.
After this preliminary study the next step is to perform extensive testing in variable selection problems. Specifically, a chemometric problem with previous results in different approaches related with the work performed [2].