A Solution to the N-Queens Problem Using Biogeography-Based Optimization

— Biogeography-based Optimization (BBO) is a global optimization algorithm based on population, governed by mathematics of biogeography, and dealing with geographical distribution of biological organisms. The BBO algorithm was used in the present study to provide a solution for the N-queens problem. The performance of the proposed algorithm has been evaluated in terms of the quality of the obtained results, cost function, and execution time. Furthermore, the results of this algorithm were compared against those of genetic and particle swarm algorithms.


I. IntroductIon
o ptImIzatIon is a process of making something better. During this process the primary conditions are examined by different methods and the obtained data are used to make improvement in an idea or a method. Optimization is a mathematical tool which includes providing answers for many questions on how to solve different problems [2,3]. Optimization deals with finding the best possible answer for a problem. Meta-heuristic algorithms simulate natural processes through stochastic optimization methods. The shorter the time and the lower the required quality of the answer, the better applying meta-heuristic approaches will be. In fact, meta-heuristic algorithms are subsets of approximate optimization algorithms which have exiting solutions from local optimization and are applicable on a wide range of problems [4].
Biogeography-based algorithm (BBO) is an evolutionary algorithm that was originally introduced by Dan Simon in 2008 [1]. BBO is a novel global optimization algorithm based on biogeography theory within the domain of smart optimization dealing with geographical distribution of biological organisms. Mathematical models of biogeography describe speciation (the evolution of new species), the migration of species between islands, and the extinction of species. This algorithm has been used for single-target optimization of many criterion functions [7,9] and solving a wide range of real-life optimization problems such as sensor selection for estimation of airplane engine efficiency [1] or categorization of satellite images [5].
Various approaches have been introduced so far as solutions to the N-queens problem, some of which are mentioned below: In the paper [10] the heuristic algorithms have been used for solving the N-queens problem. Meta-heuristic algorithms such as genetic algorithm, simulated refrigeration algorithm, and forbidden search have been applied to solve this problem. The reference [11] describes application of the genetic algorithm with various patterns for solving the N-queens problem. The paper [12] deals with the effect of the particle swarm algorithm on generating an optimum solution for the problem.
Shuihua et al. [16] proposed two novel machine-learning based classification methods. Their developed system includes, wavelet entropy (WE), principal component analysis (PCA), feed forward neural network (FNN) trained by fitness-scaled chaotic artificial bee colony (FSCABC) and biogeography-based optimization (BBO), respectively. They show that their proposed method is effective for fruit classification.
Mehran Tamjidy et al. [17] present an evolutionary optimization algorithm based on geographic distribution of biological organism to deal with hole-making process problem. The aim of their study is to minimize the none-productive time, including tool travelling time and tool switching time, by using biogeography-based optimization algorithm. Their obtained results show that the proposed algorithm can efficiently improve the solution quality in words of minimizing noneproductive time.
Vanitha and Thanushkodi [18] used an effective biogeographybased optimization algorithm to solve economic load dispatch (ELD) problem. Their proposed algorithm has been applied to ELD problem for verifying its feasibility and the convergence of EBBO is presented.
Saremi and Mirjalili [19] used biogeography-based optimization algorithm for integrating chaos. Their results show that chaotic maps are able to improve the performance of biogeography-based optimization algorithm.
There are different methods for solution of N-queen problem [13,14,15]. Also it has been applied different optimization methods for solution of N-queen problem such as particle swarm optimization (PSO), Genetic algorithms (GA) but BBO algorithm has not been used for this aim yet.
In this paper we used BBO algorithm for solution of N-queen problem and we compare performance of BBO algorithm with PSO and GA algorithms. Our comparisons are based on cost and execution time in mention of queen numbers.
The second section of the present paper deals with general principles of BBO evolutionary algorithm. The third section is focused on evaluation of the BBO algorithm and its comparison against GA and PSO algorithms. The fourth section is a conclusion to this study and ultimately some suggestions for future trends are given at the end of the paper.

II. BIogeography-Based optImIzatIon
BBO is an evolutionary algorithm based on population, which is inspired by animals and birds migration between islands. In fact, biogeography deals with geographical distribution of species. Islands that are hospitable to live have a high habitat suitability index (HSI). Features that influence HSI include rainfall, vegetative diversity, topographic characteristics, land area, and temperature. These features are called suitability index variables (SIVs). Islands with a high HSI have many species that emigrate to nearby habitats. In terms of habitability, SIVs are the independent variables and HSI is the dependent variable.
Islands with a high HSI have a low immigration rate because they already host many other species and cannot receive new members. Islands with a low HSI have a high immigration rate because of their low populations. Immigration of new species to habitats with high HSI may lead to increase in HSI in that area, since hospitability of a place depends on its geographical diversity. Application of biogeography for optimization was initially focused on using a natural process to solve an optimization problem. Similar to other evolutionary algorithms such as GA which are always associated with certain operators like mutation and selection, in BBO algorithm the operators of migration and mutation result in desirable changes in the trend of generations' creation. As the suitability of a habitat rises, the number of species and emigration rate increase, whereas immigration rate decreases [1].
Any habitat (solution) in BBO has an immigration rate ‫)ג(‬ and an emigration rate (µ) which is used in the form of possibility to share data between the solutions and are calculated by the following relations: (1) (2) where I and E represent maximum rates of immigration and emigration respectively, k(i) is the number of species in i th habitat which ranges from 1 to n that is the number of members in a certain population (n for the best solution and 1 for the worst solution).
Sudden mutations may change HSI in a habitat. Furthermore, they may make the number of species deviate from its balanced value. This issue is modeled in BBO as SIV mutation and the mutation rate is determined by probability of the number of existing species in the habitat. (3) Where m max (maximum rate of mutation) is defined by user. Ps represents the probability that the habitat supports exactly S species. Excellent and hostile habitats will tend to mutation and change. This pattern of mutation results in more diversity in population.
The stages of BBO algorithm can be summarized as follow: 1. Parameters initialization (assign initial values to the parameters);

Stochastic generation of primary solutions (habitats);
3. Obtaining the number of species, S, immigration rate, ‫ג‬ , and emigration rate, µ, related to each habitat from HSI; 4. Modification of non-elite habitat based on immigration and emigration rates, and recalculation of migration operator and HSI; 5. For each habitat the probability of the number of habitants is modified. Subsequently, each non-elite habitat is mutated, and then the mutation operator and the amount of HSI are calculated again for each habitat.
7. This cycle may end after predefined number of generations or when an acceptable solution is obtained.

III. experImentaL resuLts
The N-queens puzzle is one of the classic problems with a long history [6]. The N-queens puzzle is the problem of putting N chess queens on a ‫ג‬ chessboard such that none of them is able to capture any other using the standard chess queen's moves. In this section the results from implementing N-queens problem using BBO algorithm, and also comparison of its results with genetic (GA) and particle swarm optimization (PSO) algorithms will be discussed. Since all three algorithms are stochastic in nature, each of them has been repeated 500 times. The focus of the experiments was on the impact of variations in values of BBO parameters.
In this paper for study BBO algorithm performance in N-queen problem, we solve the problem with different queens. Our study has been done on 5, 8, 10, 20, 100, and 200. Due to BBO algorithm solution is produced such as most of other meta-heuristic algorithms stochastically so experiments are repeated 500 times and average of them is obtained in this 500 times.
Our experiments are based on effect of BBO algorithm change value. Condition of algorithm termination is reach to optimal answer and end of maximum repeat. BBO method is based on population. First, it is produced a random population for solution of N-Queen problem. This population is produced in mention of problem space (number of queens and number of population). After this main operation, BBO algorithm is performed. Then, the data is sorted for finding based possible solution. Finally, after doing these maximum solutions in population will been probability answer. Possible number of fulmination returns as cost in this method and it is written for cost function. If a solution breaks main condition of problem then it saves maximum value of fulmination as cost. For this reason, we are interested in finding optimal cost. Fig. 1 shows BBO algorithms cost function with 50 populations. Numbers of population selections are effective in optimal answer in population oriented meta-heuristic algorithm. A small number of population or unsuitable number of population selection has low variety answers so it decreases discovery power in search space and makes precocious convergence. On the other hand if number of population increases, then discovery power also increases. But more times it is required to get precocious convergence. So the number of population should be appropriate so that we can have desirable results in best time.
According to the obtained results from Tables 1 and 2, population growth leads to decrease in costs, but increase in implementation period. As the number of queens increases an appreciable increase is observed in both costs and implementation period. Variations in the mutation rate have no significant influence on costs. The following diagrams ( Fig. 1) have been plotted taking 500 implementation steps and 10 queens into account.
In comparing BBO algorithm performance with GA and PSO algorithms, execution time and number of population are considered 500 and 30, 50, respectively in N-queen problem. Mutation rate are studied for 0.2, 0.4 0.6, 0.8. Results of GA and PSO algorithms are shown in tables 3, 4, 5, 6.     By comparing PSO, GA, and BBO algorithms and considering the diagrams, it can be noticed that as the number of queen's increases the performance of the BBO algorithm becomes better relative to PSO and GA algorithms, besides the implementation period will be shorter.
This algorithm has an advantage over others for solving the N-queens problem. However, this superiority can be held up to maximum 100 queens. As it can be seen from the diagrams, BBO shows a poor performance in the cases with more queens (200 and more). Moreover, the cost of the BBO algorithm is higher comparing with GA and PSO algorithms.

IV. concLusIon
The obtained results from examination indicated capability of BBO for solving the N-queens problem. As the contrastive analysis of two algorithms showed, BBO algorithm is more accurate and quicker than PSO. Comparing with GA algorithm, the more queens are there, the better the performance of the BBO algorithm will be. The performance falls with more queens (200 and more).
In comparing BBO algorithm with GA algorithm, GA algorithm has better performance. GA algorithm is better than BBO and PSO algorithm because of their execution time. Both BBO, GA algorithms have fast convergence. If convergence of PSO algorithm is fast, then it has not exit mechanism of local optimum trap. So, it selects local optimum as global optimum while BBO algorithm escapes local optimum and gets to optimum answer.
Considering the fact that BBO is a relatively newly-developed algorithm, a wide range of potential research fields can be proposed for this algorithm. For example we can integrate this algorithm with others to achieve better results. In order to obtain more accurate answers and shorten the time of implementation, other algorithms such as exact algorithms can be used to generate better primary solutions, hence to improve the performance.
BBO algorithm can be used for the optimization problem solution of the real world as image restoration, image segmentation, video coding and wireless sensor network. We suggest that BBO algorithm is used in above problems in future work. Also this algorithm can be applied for problem solutions that are NP-hard as travelling salesman problem (TSP).