![](bg2.png)
puzzles that have unique solution. We can
summarize rules to solve Sudoku into three rules
(Satyendra and Saumi, 2013):
- Rule 1: Each row should contain values from 1 to 9
without repeating any number.
- Rule 2: Each column should contain values from 1
to 9 without repeating any number.
- Rule 3: The sub-block should contain only values
from 1 to 9 without repetition.
3 RELATED WORK
Many algorithms were proposed for solving and
generating Sudoku problems. A number of studies
can definitely solve Sudoku problems by using exact
methods (Crawford et.al, 2008), (Gunther and
Moon, 2012) and (Simonis, 2005). By using these
exact methods, easy level Sudoku problems can be
solved in a reasonable amount of time. However,
when the level gets harder, the computational time
grows exponentially and these methods become
impractical. Therefore, many researchers focus on
heuristic algorithms.
Various population-based metaheuristics have
been proposed such as ant colony optimization
algorithm (ACO) (Asif, 2009), genetic algorithm
(GA) (Xiuqin, Yongda and Ruichu, 2012), (Li and
Deng, 2011) and (Mantere and Koljonen, 2007),
harmony search algorithm (HS) (Satyendra and
Saumi, 2013). In the paper (Asif, 2009), the author
employs as heuristic information the number of
digits correctly placed on the board. However, the
best value reached is 76 where 81 being the global
optimum. Li and Deng (2011) proposed a modified
genetic algorithm for solving Sudoku games under
the name of Improved Genetic Algorithm. The
results were good in solving easy levels but it was
unable to solve higher levels. They followed their
algorithm with New Genetic algorithm (NGA)
(Xiuqin, Yongda and Ruichu, 2012) which contains
many major modifications. The results were
significantly improved in solving all Sudoku levels
even when comparing the results with other
population algorithms like GA (Mantere and
Koljonen, 2007), Cultural Algorithm (CA) (Mantere
and Koljonen, 2008) and ACO (Mantere and
Koljonen, 2009).
Another algorithm has been published by
Satyendra and Saumi (2013) using harmony
algorithm. The algorithm in addition to solving
different levels of Sudoku, it can determine the level
of the Sudoku game. The results were quite good in
solving easy levels with success rate of 100%, but
these rates are decreased along with levels of
difficulty to be 10% in the hardest level (level 5).
Although there are many population based
heuristic algorithms, there are a few trajectory-based
algorithms for solving Sudoku games. Lewis (2007)
proposed a simulated annealing algorithm to solve
different level types of (3 * 3) Sudoku games as well
as (4
* 4) games. In addition, he developed an
algorithm to create solvable problem instances with
different levels by using some rules and criteria. The
results were amazing as the algorithm solved all
samples of all levels in short time, but with more
times in solving 4 * 4 Sudoku problems. The main
factor of
reducing running time was in calculating
the fitness function by recalculating only affected
rows and columns by the swap neighborhood
structure operation. Unfortunately, the data set used
in experiments is unavailable to compare his results
with our results.
4 VNS IMPLEMENTATION
In this paper we propose a Variable Neighborhood
Search (VNS) algorithm to solve Sudoku problem.
Variable Neighborhood Search has been proposed
by Mladenovic and Hansen (1997). The basic idea of
VNS is to successively explore a set of predefined
neighborhoods to provide a better diversification of
solution. It explores either at random or
systematically a set of neighborhoods to get different
local optima and to escape from local optima. VNS
Figure 2: Pseudo-code of GVNS algorithm.
Input: a set of neighborhood structures N
k
for k = 1,,
k
max
for shaking.
a set of neighborhood structures N
l
for l = 1,.. l
max
for
local search.
x = x
0
;
Repeat
For k=1 to k
max
Do
Shaking: pick a random solution xʹ′from the k
th
neighborhood N
k
(x) of xʹ ;
Local search by VND ;
For j=1 To j
max
Do
Find the best neighbor x′′ of x′ in N
j
(x′) ;
If f (x′′) < f (x′) Then x′= x′′ ; j=1 ;
Otherwise j=j+1;
Move or not:
If local optimum is better than x Then x = xʺ
Continue to search with N
1
(k = 1) ;
Otherwise k=k+1 ;
Until stopping criteria
Output: Best found solution
AVariableNeighborhoodSearchforSolvingSudokuPuzzles
327