A Novel Evolutionary Algorithm With Column and Sub-Block Local Search for Sudoku Puzzles

Sudoku puzzles are not only popular intellectual games but also NP-hard combinatorial problems related to various real-world applications, which have attracted much attention worldwide. Although many efficient tools, such as evolutionary computation algorithms, have been proposed for solving Sudoku puzzles, they still face great challenges with regard to hard and large instances of Sudoku puzzles. Therefore, to efficiently solve Sudoku puzzles, this article proposes a genetic algorithm (GA) based method with a novel local search technology called local search-based GA (LSGA). The LSGA includes three novel design aspects. First, it adopts a matrix coding scheme to represent individuals and designs the corresponding crossover and mutation operations. Second, a novel local search strategy based on column search and sub-block search is proposed to increase the convergence speed of the GA. Third, an elite population learning mechanism is proposed to let the population evolve by learning the historical optimal solution. Based on the above technologies, LSGA can greatly improve the search ability for solving complex Sudoku puzzles. LSGA is compared with some state-of-the-art algorithms at Sudoku puzzles of different difficulty levels and the results show that LSGA performs well in terms of both convergence speed and success rates on the tested Sudoku puzzle instances.

Abstract-Sudoku puzzles are not only popular intellectual games but also NP-hard combinatorial problems related to various real-world applications, which have attracted much attention worldwide.Although many efficient tools, such as evolutionary computation algorithms, have been proposed for solving Sudoku puzzles, they still face great challenges with regard to hard and large instances of Sudoku puzzles.Therefore, to efficiently solve Sudoku puzzles, this article proposes a genetic algorithm (GA) based method with a novel local search technology called local search-based GA (LSGA).The LSGA includes three novel design aspects.First, it adopts a matrix coding scheme to represent individuals and designs the corresponding crossover and mutation operations.Second, a novel local search strategy based on column search and sub-block search is proposed to increase the convergence speed of the GA.Third, an elite population learning mechanism is proposed to let the population evolve by learning the historical optimal solution.Based on the above technologies, LSGA can greatly improve the search ability for solving complex Sudoku puzzles.LSGA is compared with some state-of-the-art algorithms at Sudoku puzzles of different difficulty levels and the results show that LSGA performs well in terms of both convergence speed and success rates on the tested Sudoku puzzle instances.

I. INTRODUCTION
S UDOKU is a popular logic-based combinatorial puzzle game for people of all ages, it was invented in 1979 and was officially named "Sudoku" in 1984 [1].The typical Sudoku is composed of 81 cells (a 9 × 9 grid), as shown in Fig. 1.Fig. 1(a) is a Sudoku puzzle with several given numbers, and Fig. 1(b) is the solution to this puzzle.Moreover, with rapid development, more complex high-dimensional Sudoku puzzles have appeared in recent years, with dimensions of 16 × 16, 25 × 25, and even 100 × 100.
The rules of Sudoku are as follows: The game begins with several given numbers in an N×N grid.Then, the player must fill in the empty cells with numbers 1 to N in such a way that no number appears twice in the same row, column, or sub-block.Sudoku puzzles are simple in form and definition, but it is not easy to find solutions [2].In 2003, Yato and Seta proved that solving Sudoku is an NP-hard problem [3].Generally, the factors for evaluating the difficulty of a Sudoku puzzle include the dimension of the problem, percentage and distribution of the given numbers, and time cost to solve the Sudoku by a baseline solver.To evaluate the difficulty of Sudoku, some typical tools have been developed, including SUDOKUSAT, Sudoku explainer (SE), and Hoduku explainer [4].Currently, the most used tool is SE, which can give a corresponding SE score.Generally, a higher SE score indicates that the Sudoku puzzle is more difficult.For example, the Sudoku puzzles can be divided into levels of easy, medium, hard, evil, and even more difficult.
Nowadays, Sudoku is not only a game but also a kind of core problem in many real-world applications in daily life and industrial engineering, such as in data encryption [5], radar waveform design [6], and education [7].For example, Jana et al. [5] proposed a video steganography technique that hid encrypted data in videos by a Sudoku-based reference matrix.This technique shows good performance in resisting fault attacks if the Sudoku puzzle can be solved efficiently.Li et al. [8] applied retracing extended Sudoku to image data-hiding technology.As the retracing extended Sudoku is a kind of Sudoku containing multiple solutions, which imposes high demands on the robustness of the algorithm for solving the Sudoku puzzle.To improve the efficiency of photovoltaic systems, Horoufiany and Ghandehari [9] proposed a Sudoku-based arrangement rule to avoid mutual shading between fixed photovoltaic arrays and obtained the optimal arrangement by solving the corresponding Sudoku puzzle by a genetic algorithm (GA).Moreover, the Sudoku is also studied as a representative of the exact cover problem [10].Therefore, the Sudoku puzzle widely exists in various applications.The development of algorithms for solving Sudoku has not only of academic research significance, but also helpful for real-world applications, which has attracted increasing attention.
So far, the existing algorithms for solving Sudoku puzzles can be divided into mathematical algorithms [11] and heuristics algorithms [12].The exact algorithms are faster at solving Sudoku puzzles, but lack portability [13].Therefore, as a type of heuristics algorithm, GA has gained widespread attention due to its powerful search ability and versatility.During the past decade, some studies have shown the great potential of GA in solving Sudoku puzzles [14].However, the GA-based methods still have some shortcomings.When solving difficult Sudoku puzzles, some GA-based methods still need to take a long time to solve or even be unsolvable [15].Therefore, developing a more efficient method to solve Sudoku puzzles remains a challenge.
In this article, we propose an improved GA with local search (LSGA) to effectively and efficiently solve Sudoku puzzles.Specifically, the LSGA has three novel designs.First, we adopt the matrix-based encoding for Sudoku, and based on this encoding scheme, the crossover and mutation operations in LSGA are designed.Second, we present a novel local search mechanism based on column search and sub-block search to increase the convergence speed of the GA.Third, to avoid being trapped in local optimal solutions, an elite population learning mechanism is proposed to randomly replace poor individuals with new individuals, which is very effective when solving difficult Sudoku puzzles.To illustrate the efficiency of the proposed LSGA, we evaluate it on Sudoku puzzles at different difficulty levels and compare it with some state-of-the-art approaches.
The rest of the article is organized as follows: Section II reviews studies on solving Sudoku puzzles in recent years.Then, in Section III, the matrix-based GA is elaborated, and the effectiveness and efficiency of the proposed LSGA are illustrated by extensive experiments in Section IV.Finally, conclusion is given in Section V.

II. RELATED WORK
The charm of Sudoku is that it is easy to learn but difficult to master.Therefore, it has received much attention since it was first published in the newspaper "Times" [16].Fig. 2 shows the structure of a standard Sudoku puzzle.To summarize the definition, the N × N ( √ N is an integer greater than 0) Sudoku puzzle must satisfy the following constraints.[17], which is a brute force algorithm.This method transforms Sudoku puzzles into exact cover problems and employs the backtracking method to solve them.However, brute force algorithms cannot handle those high-dimensional Sudoku puzzles at an acceptable time and memory cost [18].
To overcome the shortage of brute force algorithms, many heuristic approaches have been reported in the literature to solve Sudoku.For example, Sevkli and Hamza.[19] proposed two novel models based on the variable neighborhood search (VNS) algorithm to solve Sudoku: Unfiltered-VNS and filtered-VNS.The experiments showed that filtered-VNS can obtain better solution quality than Unfiltered-VNS for easy-and mediumlevel puzzles, while Unfiltered-VNS performs better in solving hard-level puzzles.Betar et al. [20] introduced an improved hill-climbing algorithm called the β-Hill-Climbing algorithm, which could escape local optima by using a random operator.Experimental results showed that the β-Hill-Climbing algorithm can find solutions within a very short time under the best parameter configuration.
Traditional Sudoku solution methods are ineffective in solving complex and high-dimension Sudoku puzzles because the Sudoku puzzles have a huge search space [21].Evolutionary computation (EC) algorithms, such as GA [22], [23], [24], ant colony optimization (ACO) [25], [26], [27], particle swarm optimization (PSO) [28], [29], [30], [31], [32], differential evolution [34], [35], [36], and estimation of distribution algorithms [37] have shown promising performance in solving Sudoku puzzles and many other complex or real-world problems [38], [39], [40], [41].For example, Mantere and Koljonen [15] adopted GA to solve the Sudoku puzzle, but this article could not effectively solve difficult Sudoku puzzles.Pathak and Kumar [42] proposed the wisdom of a crowd aggregate function for Sudoku puzzles, which can effectively prevent GA from being trapped in local optima.Deng and Li [43] proposed an efficient hybrid algorithm for Sudoku.In this hybrid algorithm, the improved GA can produce more abundant individuals to participate in crossover.Then, they combined PSO with GA, so that the population could better evolve towards the optimal solution.Lloyd and Amos [16] adopted ACO to solve high-dimensional Sudoku puzzles and compared the effect of the percentage of given numbers on the difficulty of Sudoku.
Summarizing the above algorithms, we can conclude that the search ability and convergence speed of the algorithms are key indicators for solving Sudoku puzzles, because of the huge search space and unique solutions of Sudoku puzzles.In this article, we present an improved GA, called LSGA, which adopts the new local search method designed for Sudoku puzzles and a new elite population learning mechanism to solve Sudoku puzzles more effectively and efficiently.

A. Representations and Initialization
When solving Sudoku puzzles, it is necessary to encode the possible solutions into data structures, which facilitate the evolutionary operations of the GA.For example, Rodríguez-Vázquez [44] recorded the given numbers and solutions of Sudoku with two strings of length N 2 , and a string of length N to record the numbers waiting to be selected in each row.Mantere and Koljonen [15] used two arrays of N 2 numbers to represent the Sudoku solution: one represented the solution, and the other recorded the position of the given numbers.
In our algorithm, we adopt two matrices to represent a chromosome, one matrix is the major matrix that records the numbers in each position of the Sudoku grids, while another matrix is the associated matrix that records where each position is occupied by a number.Specifically, the number in row i and column j in Sudoku is recorded at position (i, j) of the major matrix.Meanwhile, for the associated matrix, if there is a given number at a position, then the corresponding value of the associated matrix is "1;" otherwise, it is "0."This coding method facilitates the implementation of crossover operation and local search operation.
The initialization stage is an important process of the GA.To reduce the complexity of the puzzle, all non-given numbers in each row are randomly assigned to the empty spaces, as shown in Fig. 3. Therefore, the initial solutions will satisfy the row rules of Sudoku.

B. Fitness Function
The goal of solving a Sudoku puzzle is to find the solution where each number occurs only once on each row, column, and sub-block.Therefore, when evaluating an individual, we count how many rows, columns, and sub-blocks are incorrect (i.e., not including all the numbers from 1 to N).Therefore, the fitness of the optimal solution is 0, which means that the rows, columns, and sub-blocks of this individual satisfy all rules of Sudoku.
As the individuals generated by the initialization already satisfy the constraints of the row rule, LSGA only needs to optimize the numbers in the columns and sub-blocks without breaking the row rule.In summary, the fitness of each individual can be evaluated by where N is the dimension of the Sudoku puzzle, and c i indicates whether the ith column satisfies the rule of Sudoku.That is, c i equals 0 if the ith column satisfies the rule and equals 1 if it does not.Correspondingly, s j represents whether the jth sub-block satisfies the limitations.F is the sum of r i and s j .When F equals 0, it indicates that the algorithm finds the optimal solution.

C. Crossover and Mutation
Crossover operations emphasize the exchange of genes among individuals.In LSGA, the crossover operator is performed by rows.Specifically, the parents are selected based on the individual crossover rate PC1.Subsequently, based on the row crossover rate PC2, the same rows from the parents are selected to participate in the swap operation.An example of the crossover is shown in Fig. 4. In this figure, two parents are selected based on PC1.Then, the same rows of the two parents are selected to swap based on PC2.Because the given numbers in the same row are in the same position, such as "2" and "7" in Fig. 4, the swap operation will not change the original Sudoku puzzle.
The pseudocode of the crossover operation is shown in Algorithm 1.In lines 2-3 of Algorithm 1, we select two individuals based on the individual crossover rate PC1.Subsequently, in lines 4-8, rows are selected to swap based on the row crossover rate PC2.Finally, in line 10, the offspring of the crossover are preserved.
Mutation is an important operation for the population to explore the solution space and helps populations escape local Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.Select the second parent from the population randomly; 4: For each row in the individual: 5: If rand2<PC2: // rand2 is a random variable in [0, 1]: 6: Parents exchange the selected rows; 7: End If 8: End For 9: End If 10: Save the offspring to the new population; 11: End For Output: new population optima.Here are two different mutation strategies to help the GA improve its exploration capabilities: swap mutation and reinitialization mutation.
The swap mutation operation is performed as a swap of two positions inside random rows to ensure that each row satisfies constraint (2) of Sudoku (see Section II).The associated matrix is used to check if the position is appropriate for mutation.If the value is "1," this position is occupied by a given number and this corresponding position is illegal to exchange; thus, the given numbers will not be changed during the mutation.The probability of the swap is determined by the swap mutation rate PM1.As shown in Fig. 5(a), the above mutation is legal, while the below mutation is illegal.The reinitialization mutation performs the mutation by reinitializing the distribution of the random rows.As shown in Fig. 5(b), the number of given numbers is retained while the non-given numbers are randomly assigned to the empty space at random.The reinitialization mutation can help the algorithm jump out of the local optima better than the swap mutation.However, a high mutation probability for reinitialization mutation will slow the convergence of the algorithm, so the reinitialization mutation rate PM2 is a value smaller than 0.1 and the fitness of individuals is the worst.
The pseudocode of the mutation operator is shown in Algorithm 2. In lines 3-7 of Algorithm 2, rows are selected to participate in the swap mutation based on the PM1.In lines 4-6, here is a judgment on the feasibility of the swap.If there is only one non-given number in a row, this row cannot participate in the swap.In lines 8-10, rows are reinitialized based on PM2.

D. Column and Sub-Block Local Search
Many studies have shown that local search is an effective technique for improving the convergence speed of the algorithm [45].Therefore, we design a new novel local search method in LSGA for solving Sudoku puzzles.It has two components: column local search and sub-block local search.
The first component is the column local search, which is designed to eliminate the repeating numbers in columns.First, count all columns that do not meet the rules (called illegal columns).We define the set C to record these columns.Then, each illegal column is randomly paired with the other columns in C, which will be swapped if the repeat numbers are in the same row and none of them are in each other's column.For example, Fig. 6 depicts a part of the solution to a 9 × 9 Sudoku puzzle, where we use 1 to mark the position of the repeated number.According to the rules of Sudoku, the number "1" is the repeat number in column A and "2" is the repeat number in column B. Therefore, both columns all have repeat numbers in the sixth row, so we can exchange "1" and "2" to make column B a legal column.Then, column A continues to swap with column C, which could make both of them meet the column rules.
The second component is the sub-block local search.Similar to the column local search, the sub-block local search swaps the repeat number in the same row.First, it counts all sub-blocks that do not meet the rules (called illegal sub-blocks).We define the set S to record these sub-blocks.Then, each illegal sub-block is randomly paired with the other sub-blocks in S, swapping them if the repeat numbers are in the same row and none of them is in each other's sub-block.For example, in Fig. 7, sub-block A and sub-block B both have repeated numbers, one of which is "9" and the other is "8".Therefore, we can exchange them on the same row to make both sub-blocks satisfy the Sudoku rules.
In summary, the basic idea of local search is to make the columns and sub-blocks on both sides gradually satisfy the rules of Sudoku by exchanging repeated values.Algorithm 3 describes the basic framework of the local search.

E. Elite Population Learning
As the local optimal solution and the global optimal solution of Sudoku puzzles are very different, it is difficult for the GA to jump out of the local optima.Thus, a learning mechanism based on elite populations is proposed to avoid the GA falling into local optima.The elite population is a queue structure, that records the best individuals of each generation and updates them with new optimal individuals.In elite population learning, the worst individuals in the population are replaced by a random individual x random from the elite population or are reinitialized.We define the probability P b to control this process.
The replacement operation is as follows: where x worst is the worst individual, Maxfx is the fitness of x worst , x random is a randomly selected elite individual with fitness is fx(x random ), rand() outputs a random variable in (0, 1), and init() is the initialization function.
According to (2), the worst individual in each generation has only two choices: to be replaced or to be reinitialized.Therefore, in most cases, the algorithm tends to search toward the current optimal solution via replacement but still explores new search directions via reinitialization.Thus, LSGA can balance exploration and exploitation.

F. Overall LSGA Method
Integrating the above techniques using GA, the developed LSGA is outlined in Algorithm 4. In detail, the individuals are generated through initialization in line 1.Then, the population is optimized by evolutionary operations in lines 4-6.Subsequently, in lines 7-8, local search operations are applied to speed up the convergence of the algorithm.Then, the fitness of individuals is evaluated in line 9 and the elite population learning strategy is Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.executed in line 10.The algorithm iteratively repeats the above operations until the optimal solution is found or the maximal number of generations is reached.

A. Comparisons With State-of-the-Art Methods
To illustrate the performance of LSGA, we compare it with state-of-the-art algorithms, including the node-based coincidence algorithm named NB-COIN [13], the preserve building blocks GA named GA-I [46], and the GA with local optima handling named GA-II [18].To make a fair comparison, the population size is set to 150, while all algorithms run 1 × 10 4 generations.The parameter settings of LSGA are given in Table I.
In the experiments, six classic Sudoku puzzles, which are also solved by the compared algorithms NB-COIN, GA-I, and GA-II, are selected.These Sudoku puzzles cover three difficulty levels (i.e., easy, medium, and hard), as shown in Fig. 8.Each algorithm runs 100 times on each puzzle, where Succ_Count is the number of runs among the 100 runs that can find the optimal solutions within 1 × 10 4 generations, and Avg_Gen is the average number of generations required to find the optimal solution.Note that to ensure the fairness of the comparison, the experimental results of the compared algorithms are obtained directly from their original papers.Table II gives the experimental results.
From Table II, we can see that in these six Sudoku puzzles, LSGA, NB-COIN, and GA-II all obtain the final results in all 100 runs, while GA-I in Hard 106 only finds the solution in 96 runs.Thus, LSGA, NB-COIN, and GA-II are better than GA-I.Subsequently, compared with NB-COIN, the performance of LSGA is worse than NB-COIN when solving easy-level puzzles.Furthermore, as NB-COIN depends on probability distributions to generate solutions for Sudoku, NB-COIN is less influenced by local optimal solutions than other GAs.Specifically, both LSGA and the other comparison algorithms solve Hard 106 with more generations than Hard 77, but the performance of NB-COIN on the two puzzles is not very different.By analyzing the solution process, we found that there is a very competitive local optimal solution in the Hard 106.This local optimal solution has only two columns that do not conform to the rules of Sudoku, but its structure is different from the best solution.As a result, the GAs can easily fall into this local optimum.In general, comparing the results of solving medium-level, and hard-level Sudoku puzzles, the average number of generations of LSGA is less than GA-I, GA-II, and NB-COIN.Therefore, the performance of LSGA in solving Sudoku puzzles is very competitive.
Next, we conduct an experiment on three so-called super difficult Sudoku puzzles named super difficult-1 (SD1), AI-escargot (SD2), and super difficult-2 (SD3) selected from [14].These are shown in Fig. 9.Among these three puzzles, the AI Escargot is one of the most difficult Sudoku puzzles in the world [46].Table III gives the comparison result of LSGA and some other algorithms that have successfully solved these super difficult puzzles: GA-III [14], GPU-GA [47], and GA-I [46].Each algorithm runs 100 times on each puzzle, where Succ_Count is the solution success rate among the 100 runs within 1 × 10 4 generations, and Avg_Gen is the average number of generations required to find the optimal solution.
From Table III, we see that LSGA and GPU-GA can solve all puzzles with 100% success rate, while GA-I and GA-III cannot.Moreover, both LSGA and GPU-GA require fewer number of generations than the other algorithms in each puzzle, and LSGA requires the fewest.Furthermore, we evaluate the difficulty of SD1, SD2, and SD3 with the help of the SE and get scores of 7.2, 10.5, and 2.8, respectively, which means, for the Sudoku solving methods that have been recorded in SE (such as WXYZ-Wing, Swampfish, ALS-Wing, etc.), SD2 is very difficult to solve, but SD3 is much simpler.However, the experimental results in Table III are different.Compared with SD1 and SD2, LSGA uses much more generations to solve the SD3, this situation not only occurs in LSGA, but also in other compared GAs in Table III.Therefore, we consider that if some known methods for solving Sudoku can be introduced into GA, the efficiency of solving difficult Sudoku puzzles could be greatly improved.

B. Statistical Performance on Open Sudoku Puzzles
To illustrate the statistical performance of LSGA on more Sudoku puzzles, we conduct experiments based on a large number of Sudoku puzzles selected from the open website Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.www.websudoku.com.We select Sudoku puzzles from four difficulty levels: easy; medium; hard; and evil.In each difficulty level, 30 puzzles are randomly selected.Therefore, totally 120 puzzles are adopted for testing.The details of all the 120 puzzles are provided in the Supplemental_Material.The configurations of LSGA are the same as those in Table I.LSGA runs 10 times on each puzzle and the average performance of the 10 runs is calculated and given as Avg_Gen in Table S.I in the Supplemen-tal_Material.Then, the mean performance of the LSGA on all the 30 puzzles (i.e., the 30 Avg_Gen values) in each difficulty level is given as Mean_Gen in the last row of Table S.I.Moreover, all the Mean_Gen values of the four difficulty levels and other statistical values are given in Table IV.For example, in the second row of Table IV for all the 30 puzzles in easy level, the average number of generations needed by LSGA to obtain the optimal solution to each puzzle among the 10 runs is calculated, and then the maximal average number and the minimal average number among the 30 puzzles are given as Max_Gen and Min_Gen.Moreover, the mean of the 30 average numbers is given as Mean_Gen and the Mean_Succ_Rate is the success rate of LSGA in solving all the 30 puzzles in all the 10 runs.From Table IV, we see that LSGA efficiently solves all puzzles.As the difficulty level increases, the number of generations needed by LSGA to obtain the optimal solution also increases exponentially, especially for the puzzles of the evil level.Therefore, we conduct a further investigation on the factors affecting the performance of the LSGA in the following part.

C. Further Investigation and Discussion
To further study the factors affecting the performance of LSGA, we decide to rate and generate Sudoku puzzles by using SE.The score of a Sudoku puzzle in SE is determined by the complexity of the skills required to solve it.The more complex the skills required to solve a Sudoku puzzle, the higher SE score it will get, which can determine the difficulty level of the Sudoku puzzle accordingly.This type of evaluation is very effective for players and is widely used [4].Therefore, we use SE to generate Sudoku puzzles with seven difficulty levels, each difficulty level containing 10 different Sudoku puzzles.These seven levels are called easy, medium, hard, superior, fiendish, super, and advance, and their SE score intervals are [1.0,1.2], [1.3, 1.5], [1.6, 2.6], [2.7, 3.9], [4.0, 5.9], [6.0, 6.9], and [7.0, 8.0], respectively.The details of all the 70 puzzles are given in the Supplemental_Material.The LSGA is adopted to solve these Sudoku puzzles.Similar to the experiments in Section IV-B, each puzzle is solved ten times and the average number of generations needed by LSGA to obtain the optimal solution of the ten runs is calculated.Then, we can obtain ten average results on each difficulty level (i.e., there are ten puzzles and each puzzle has an average result).The details of these ten average results are given in Table V and their distribution is plotted as Box in Fig. 10.There are seven columns in Table V and seven Boxes in Fig. 10 for seven difficulty levels.Moreover, we also look into the number of given numbers in all the 70 puzzles.Fig. 11 shows the average number of generations needed by LSGA to solve Sudoku puzzles with different given numbers.For example, the first bar means that, there may be several puzzles among the 70 puzzles that are with 23 given numbers, then the average number of generations needed by LSGA to solve each of these several puzzles among the 10 runs is calculated, and at last the mean of these several average values is calculated, which is 177.
As shown in Fig. 10 and Table V, we can conclude that the required generations for LSGA to solve Sudoku are not significantly affected by difficulty levels.For example, the generations required to solve most Sudoku puzzles at the hard and superior levels are less than that at the Medium level.That is, LSGA inherits the problem-independent characteristics of GA and is more general for Sudoku puzzles.Moreover, as shown in Fig. 11, we can conclude that there is a correlation between the difficulty of solving Sudoku puzzles and the number of given numbers.More given numbers can give LSGA more help in finding a solution, because the given numbers can effectively reduce the search space and eliminate interference solutions.However, the relationship between the given numbers and difficulty is not strictly linear or exponential.That is, there exists the situation that some Sudoku puzzles with more given numbers but are more difficult to be solved because these given numbers do not provide enough clues to determine the non-given numbers.For example, in Section IV-A, Sudoku puzzle hard 106 (with 24 given numbers) is more difficult than Sudoku puzzle SD2 (with 23 given numbers), because some Sudoku puzzles like Hard 106 have many local optimal solutions and their given numbers cannot effectively help LSGA to escape from the local optimal solutions.

V. CONCLUSION
In this article, we propose an improved GA with a local search (named LSGA) for Sudoku.In particular, we adopt a matrixbased encoding GA and devise mutation and crossover operators for this coding scheme.Then, to improve the convergence speed of LSGA, a local search method incorporating column and subblock search is proposed.Finally, by comparing with GA-based algorithms in different dimensions and levels of Sudoku puzzles, LSGA successfully solves all of these puzzles and shows good performance.
LSGA can also be applied to solve other types of Sudoku puzzles such as Mini Sudoku and Ring Sudoku.However, for Sudoku variants, such as Killer Sudoku and Kakuro Sudoku [48], the initialization and local search strategies need to be redesigned because the local search in LSGA is designed for regularly shaped sub-blocks.Furthermore, for puzzles without sub-blocks, such as those of Futoshiki and Takuzu [49], the column local search strategy is still applicable.Therefore, LSGA deserves further research to better solve other Sudoku puzzles.Although our algorithm is successful in solving many Sudoku puzzles, there is still room for improvement.For example, with the help of manual Sudoku solving methods, such as direct hidden pair and fish methods [50], humans can easily find numbers in the irrational position and adjust them, whereas LSGA needs several, tens, or even hundreds of generations to achieve the same results.Therefore, in the future, we can improve the performance of LSGA by combining it with other Sudoku-solving methods.

Fig. 3 .
Fig. 3. Initialization stage: non-given numbers in row i are randomly assigned to empty spaces.

Fig. 6 .Fig. 7 .
Fig. 6.Example of column local search.Repeat numbers are marked as 1, and others are marked as 0.

Algorithm 3 :population 1 : 3 : 5 : 6 :
Pseudocode of Local Search.Input: For each individual in population: 2: Record all illegal columns (sub-blocks) in the set C (S); For each column (sub-block) in C (S): 4: Randomly select another column (sub-block) from C (S); If the repeat numbers are in the same row: If repeat numbers do not exist in both columns (sub-blocks)

Fig. 9 .
Fig. 9. Three super difficult Sudoku puzzles and their solutions.(a) Initial Sudoku puzzle.(b) Solution to puzzle.(c) Initial Sudoku puzzle.(d) Solution to puzzle.(e) Initial Sudoku puzzle.(f) Solution to puzzle.
A Novel Evolutionary Algorithm With Column and Sub-Block Local Search for Sudoku Puzzles Chuan Wang, Bing Sun, Student Member, IEEE, Ke-Jing Du, Jian-Yu Li , Member, IEEE, Zhi-Hui Zhan , Senior Member, IEEE, Sang-Woon Jeon , Member, IEEE, Hua Wang , Senior Member, IEEE, and Jun Zhang , Fellow, IEEE

TABLE II RESULTS
OF PROPOSED LSGA AND OTHER METHODS FOR SOLVING SUDOKU ON SIX DIFFERENT SUDOKU PUZZLESTABLE III RESULTS OF PROPOSED LSGA AND OTHER METHODS FOR SOLVING SUDOKU ON THREE SUPER DIFFICULT SUDOKU PUZZLES Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

TABLE IV RESULTS
OF PROPOSED LSGA FOR SOLVING SUDOKU PUZZLES AT WWW.WEBSUDOKU.COM 10.Distributions of the average generations needed LSGA to solve Sudoku puzzles with different difficulty levels.

TABLE V AVERAGE
GENERATIONS NEEDED BY LSGA TO SOLVE EACH SUDOKU PUZZLE WITH DIFFERENT DIFFICULTY LEVELS Fig. 11.Mean generations needed by LSGA to solve Sudoku puzzles with different given numbers.