Exact Method for Generating Strategy-Solvable Sudoku Clues

A Sudoku puzzle often has a regular pattern in the arrangement of initial digits and it is typically made solvable with known solving techniques, called strategies. In this paper, we consider the problem of generating such Sudoku instances. We introduce a rigorous framework to discuss solvability for Sudoku instances with respect to strategies. This allows us to handle not only known strategies but also general strategies under a few reasonable assumptions. We propose an exact method for determining Sudoku clues for a given set of clue positions that is solvable with a given set of strategies. This is the first exact method except for a trivial brute-force search. Besides the clue generation, we present an application of our method to the problem of determining the minimum number of strategy-solvable Sudoku clues. We conduct experiments to evaluate our method, varying the position and the number of clues at random. Our method terminates within $1$ minutes for many grids. However, as the number of clues gets closer to $20$, the running time rapidly increases and exceeds the time limit set to $600$ seconds. We also evaluate our method for several instances with $17$ clue positions taken from known minimum Sudokus to see the efficiency for deciding unsolvability.


Introduction
Sudoku is a popular number-placement puzzle. In an ordinary Sudoku (Figure 1), given a partially completed 9 × 9 grid, the goal is to fill in all empty cells with digits from 1 to 9 in such a way that each cell has a single digit, and each digit appears only once in every row, column, and 3 × 3 subgrid.
Sudokus that appear in books, newspapers, etc often have the following characteristics.
(1) The arrangement of initial digits (called clues) forms a regular pattern. (2) The level of difficulty is moderate.  Figure 1 has reflection symmetry on the two diagonal axis. It may also has the shape of a number, a letter, or a symbol. Regarding 2, completing Sudokus generally requires backtracking, which is amenable to computers. On the other hand, there is a set of techniques (called strategies) that humans use in solving Sudokus by hand [1]. Typically strategies are ifthen rules: If a strategy is applicable to the current grid, then it might rule out digits as candidates or might determine digits as those to be finally placed. A strategy-solvable Sudoku is a partially completed grid that can be completed by applying strategies repeatedly. Here, the strategies must be selected from a set of predetermined ones. Since there is no need to guess, strategy-solvable Sudokus (at least for a few basic strategies) might be referred to as Sudokus having the moderate level of difficulty for humans.
Making new Sudoku instances having these characteristics is not an easy task. There is a public software 1 , which is able to generate Sudokus from a given set of clue positions so that they are solvable with some known strategies. However, it is still hard to generate those with 20 or less clues and those with around 45 or more clues. For such instances, there might be no other choice but to rely on human intelligence involving the intuition, the inspiration and the experience of enthusiasts.
In this paper, we consider a method for determining Sudoku clues in specified positions such that all empty cells can be filled in with a specified set of strategies (see Figure 2). Almost all Sudoku generators simply output proper Sudoku instances (i.e. partially completed grids having unique solutions). Clue arrangements and strategies necessary for solving are uncontrollable. To the best of our knowledge, the only exception is the generator of Zama and Sasano, mentioned earlier. Their generator is based on the generateand-test method, which repeats the followings until the test is passed or the number of trials exceeds a predetermined limit.
(2) Test whether all the other cells are completed using specified strategies only. The same idea is also mentioned in [4]. Since the test step can be done quickly, the key is to devise a criterion for the generation step so that the number of trials is as small as possible.
Since the generate-and-test method examines only a limited portion of the vast search space, it has the drawbacks listed below.
• The lower the density of solutions (i.e. strategy-solvable clues) over the whole search space becomes, the harder it becomes to find a solution. • If a set of clue positions happens to be not strategy-solvable, it is unable to recognize it no matter how much time passes. • Even for a strategy-solvable set of clue positions, there is no guarantee for being able to find a solution in a finite amount of time. To tackle these issues (in particular the last two), we consider it necessary to formulate the concept of strategy-solvability. It seems that strategy-solvability has been recognized intuitively, and no formal treatment has been given so far. In this paper, we introduce a rigorous framework to discuss solvability for Sudoku instances with respect to strategies and define the notion of strategy-solvable Sudoku clues. This allows us to handle not only known strategies but also general strategies under a few reasonable assumptions. We then propose an exact method for determining strategy-solvable Sudoku clues for a given set of clue positions that is solvable with a given set of strategies. The key is a reduction to a constraint satisfaction problem (CSP). Our method is able to benefit from the power of state-of-the-art CSP solvers. Pruning techniques of CSP solvers are expected to be effective for the first issue above. Moreover, as long as any complete CSP solver is utilized, it is guaranteed that if a set of clue positions is not strategy-solvable, our method eventually recognizes the unsolvability; otherwise, our method eventually finds strategy-solvable clues. This is the first exact method except for a trivial brute-force search. As strategies allowed in completing Sudokus, this paper employs naked singles, hidden singles, and locked candidates [1], which are quite basic yet enough powerful to complete many Sudokus. Indeed, we have confirmed that the combination of the three strategies allows for solving as many as 37, 373 of the 49, 151 minimum Sudokus (i.e., Sudokus with 17 clues) collected by Gordon F. Royle [6]. Here we remark that our CSP formulation is almost independent of specific strategies. In order to allow other strategies, it is sufficient to formulate the corresponding logical constraints and add them with a minor modification of the strategy-independent part.
Besides the clue generation, we present an application of our method to the problem of determining the minimum number of Sudoku clues that are solvable with a given set of strategies. We demonstrate that our method is easily customized for this problem with a small modification in the CSP constraints. It is well-known that there is no proper Sudoku with 16 or less clues [5]. There are many Sudokus with 17 clues that are solvable with basic strategies such as hidden singles. Interestingly, this may not be the case for naked singles, arguably one of the most basic strategy, as we have confirmed that no grid solvable with only naked singles is included in the minimum Sudoku collection. This poses an open problem of whether there is a gap between the minimum numbers for strategy-solvable Sudokus and proper Sudokus. Our method will be useful in tackling this problem thanks to the ability of determining unsolvability.
We conduct experiments to compare our method with the generator of Zama and Sasano [9], using grids varying the position and the number of clues at random. From the results, we observe that our method terminates within 1 minutes for many instances, showing our method being stable in terms of running time. However, as the number of clues gets closer to 20, the running time rapidly increases and exceeds a time limit. On the other hand, the generator of Zama and Sasano often can find solutions much faster even in near 20 clues, while the performance sharply deteriorates around 45 clues and exceeds the time limit for all grids with more clue positions. Perhaps this is due to the exponential blow-up of the search space (in other words, the exponential decline in the density of solutions). We also evaluate our method for several instances with 17 clue positions taken from known minimum Sudokus to see the efficiency for deciding unsolvability.
The main contributions of the present paper are to formulate the concept of strategy-solvability, to establish an exact method for the strategy-solvable Sudoku clues problem, and to demonstrate the flexibility of the CSP-based approach. It remains as future work to improve our method in less clues.
Unless otherwise noted, the size of Sudoku is fixed to 9×9 throughout the paper. This is simply for convenience and our method can be easily translated into general Sudokus on n 2 × n 2 grid.
The paper is organized as follows. Section 2 introduces necessary notations, terminology, and explains strategies. Section 3 formulates the concept of strategy-solvability and the strategy-solvable Sudoku clues problem. Section 4 proposes an exact method for the strategy-solvable Sudoku clues problem, and Section 5 presents two improvements for our method. Section 6 presents an application to the strategy-solvable minimum Sudoku problem. Section 7 presents experimental results. Section 8 concludes this paper.

Preliminaries
In this section we introduce necessary notations and terminology, and we explain strategies.
2.1. Notations and Terminology. For convenience, rows and columns are numbered from 0 to 8. A cell is denoted by the pair (i, j) of a row index i and a column index j. The 9 subgrids of 3 × 3 are called blocks. Rows, columns, and blocks are collectively called groups. A group is identified with the set of all cells in the group. By abuse of notation, we denote by G\(i, j) the difference of a singleton {(i, j)} from a group G.
Given a partially completed grid, the goal of a Sudoku puzzle is to fill in all empty cells with digits from 1 to 9 in such a way that • each cell has a single digit, and • each digit appears only once in every group.
The completed grid is called a solution. A Sudoku is a convenient alias for a partially completed grid given as an initial grid. A Sudoku is proper if it has a unique solution. The occurrence of a digit in an initial grid is called a clue, and Sudoku clues are the clues in an initial grid. A cell in an initial grid to which some digit is designated to be placed as a clue is called a clue cell or a clue position. . Starting with the partially completed grid on the left, one can reach the grid on the right using only naked singles but cannot proceed any more.

2.2.
Strategies. There is a set of techniques (called strategies) that humans use in solving Sudokus by hand [1]. Typically strategies are if-then rules: If a strategy is applicable to the current grid, then it might rule out digits as candidates or might determine digits as those to be finally placed. Throughout the following explanation, let n be a nonzero digit and (i, j) be a cell.
A naked single is a strategy that places n in (i, j) if no other candidate but n remains at (i, j). For example, let us look at the gray cell (4,7) in the left grid of Figure 3. Since all digits but 5 appear in either group having (4, 7), these digits must be ruled out and only 5 remains. Hence, 5 is placed in (4,7). Starting with the left grid of Figure 3, one can reach the right grid using only naked singles, but cannot proceed any more because of two or more candidates over all empty cells.
A hidden single is a strategy that places n in (i, j) if there is a group G having (i, j) such that no cell in G \ (i, j) has n as a candidate. For example, let us look at the right grid of Figure 3. For the row of index 1, we can observe that every cell in the row except for the gray cell (1, 6) does not have 7 as a candidate. Indeed, for any such cell, 7 already appears in another cell of the same column. Hence, a hidden single strategy determines 7 in (1,6). In this way, by applying hidden singles repeatedly, the grid can be completed.
Let A, B be groups such that |A ∩ B| = 3. A locked candidate is a strategy that rules out n over all cells in one difference set B \ A if no cell in the other difference set A \ B has n as a candidate. For example, let us look at the right grid of Figure 3. Let A be the column of index 7, and let B be the block adjacent, on the right, to the center block. No empty cell in A \ B has 3 as a candidate because for each such cell, there is another cell in the same row to which 3 is already placed.
Hence, 3 is ruled out for all empty cells in B \ A. Because of this, 2 becomes a unique candidate at (3,6). It is determined as the digit at (3, 6) by a naked single. In this way, the grid also can be completed using locked candidates as well as naked singles.

Formulation
Although some known strategies are introduced in the previous section and some solvable cases are explained using particular grids, there are still unclear points such as what is a strategy in general and what operations are allowed for placing or ruling out digits, and so on. In this section, we thus introduce a rigorous framework to discuss solvability for Sudoku instances. This allows us to handle not only known strategies but also general strategies under a few reasonable assumptions. This also makes it clear that, for example, it is not allowed to temporarily place digits and then cancel them when a contradiction occurs. Such an inference would allow us to do backtracking, which nullifies the restriction of completion methods. A state transition model of Sudoku is a tuple (Q, R, I, F ) such that Q is the set of all possible states, R is a state transition relation, I is the set of initial states, and F is the set of final states. We will explain each component below. Figure 4 shows how a grid evolves as strategies are applied, which will be used as an example in the succeeding explanation.
A state of grid (or a state in short) is a pair (f, g) of functions. The function f maps the set of cells to the set of digits, and f (i, j) = n means that if n = 0, then n is placed in (i, j); otherwise, no digit is placed. The function g maps the set of cells to the powerset of the set of nonzero digits, and g (i, j) represents the set of all candidates at (i, j). Here, by abuse of notation, f (i, j) and g (i, j) denote f ((i, j)) and g ((i, j)), respectively. All states must satisfy the conditions S 1 and S 2 below: for all cells (i, j) and nonzero digits n, We denote by Q the set of all states. The antecedent of S 2 is a condition for digits n that can be safely ruled out whenever some digits are placed. Imposing S 2 ensures that all such digits are ruled out. This is simply to make all states having a type of normal form, and it would not deduce any wrong consequence as long as decisions for number-placements are correct such as not violating the properness. In Figure 4 we can observe that all grids are in "normal form".
A state transition relation is a binary relation R ⊆ Q × Q. The (q, q ) ∈ R (or qRq in infix notation) means that there are strategies by which q is changed to q . We refer to q and q as the source state and the target state of the transition, respectively. All state transitions must satisfy that for any cell (i, j) and nonzero digit n, if f (i, j) = n holds in the source state, so does in the target state; if n ∈ g (i, j) holds in the source state, so does in the target state. This simply means that once digits are placed or ruled out, then it cannot be canceled afterward. We put one more assumption as follows. For any three states q 1 = (f 1 , g 1 ), q 2 = (f 2 , g 2 ), and q 3 = (f 3 , g 3 ) with q 1 Rq 2 and q 2 Rq 3 , if g 1 = g 2 , then q 2 = q 3 . We consider this assumption not so strong. Indeed, many strategies such as naked singles and hidden singles decide to place digits by examining only candidates. For such strategies, suppose that q 2 is obtained from q 1 by applying all strategies applicable to q 1 . Then, if g 1 = g 2 , no strategy applicable to q 2 remains, and q 2 cannot be changed any more, i.e., q 2 = q 3 .
A state q = (f, g) ∈ Q is an initial state if it satisfies the followings: f (i, j) = 0 for all clue cells; f (i, j) = 0 for the other cells; n ∈ g (i, j) if and only if the antecedent of S 2 holds. The last condition ensures that for each clue cell, all digits but the determined one are ruled out; all digits that appear as candidates in a common group to some determined digit are ruled out; (the only-if part) no other digits are ruled out. Notice that the only-if part is the most essential because the if part can be omitted thanks to S 2 . By the way, for non-initial states, this must not be assumed in general because of strategies for number-removals such as locked candidates. For example, in the left most grid of Figure 4 we can observe that all digits not designated to be ruled out by the antecedent of S 2 remain as candidates. We denote by I the set of all initial states.
A final state is a state such that digits are determined for all cells, that is, f (i, j) = 0 for all (i, j). We denote by F the set of all final states.
Definition 3.2. Let (Q, R, I, F ) be a state transition model of Sudoku. The Strategy-solvable Sudoku Clues problem (or SSC in short) is to determine whether there is a strategy-solvable state of (Q, R, I, F ).
Suppose that R is given as a logical formula that represents strategies and a set S of clue cells is also given. Consider Q, I, and F as the ones defined as described above. Sudoku clues are strategy-solvable if the initial state corresponding to the Sudoku clues is strategy-solvable with respect to (Q, R, I, F ). The strategy-solvable Sudoku clues problem is defined accordingly. If the output of the problem is yes, in practice we will also ask for generating strategy-solvable Sudoku clues.
, applying S 2 , we obtain n ∈ g (i, j) for all n = n. From both, g (i, j) = ∅ follows, and this is contradictory to S 1 .

Corollary 1. Every final state represents a Sudoku solution.
Proof. Let q = (f, g) be a final state. Since f is a function, each cell must have a single digit. From Proposition 1 and f (i, j) > 0, it follows that each digit appears once in every group.
Notice that this corollary holds no matter what state transition relation is given.

Our Method
In this section, we propose an exact method for the strategy-solvable Sudoku clues problem (SSC). As strategies allowed in completing Sudokus, this paper employs naked singles, hidden singles, and locked candidates, which are quite basic yet enough powerful to complete many Sudokus.

4.1.
Overview. The key of our method is to encode a given SSC instance to an equivalent constraint satisfaction problem (CSP) instance and then to solve it using a generic CSP solver. For the CSP encoding, we introduce variables for representing states of grid and other auxiliary variables. Using such variables, we represent constraints for states, state transitions, particular strategies, and so on.
Any variable assignment that satisfies all such constraints substantially corresponds to a sequence of states q 0 , . . . , q k with q 0 strategysolvable, as characterized in Definition 3.1. Here, the initial state q 0 represents an assignment of digits to clue cells and the whole sequence represents a history of evolving grids and applied strategies, which eventually reaches a Sudoku solution. Hence, by applying a CSP solver to the encoded constraints, we eventually obtain strategy-solvable Sudoku clues if exist; otherwise, we eventually recognize the strategyunsolvability of the clue cells, that is, no assignment of digits to the clue cells is strategy-solvable.
The details of our method are explained as follows. At first, we present constraints for a state transition framework, which is almost independent of particular strategies. As stated above, we introduce variables for representing states of grid and auxiliary variables. We then represent various constraints using such variables. After that, we shift to particular strategies. we present constraints for numberplacements and constraints for number-removals. We finally provide the whole picture of our method as well as some remarks.

Constraints for A General State Transition Framework.
We introduce variables for representing states of grid. We then present constraints for initial states, constraints for state transitions, constraints for final states. 4.2.1. Variables. Let q k = (f k , g k ) be a state of grid in step k ≥ 0, i.e., a state reachable from an initial state by k transitions. Let i and j be a row index and a column index, respectively. The integer variable X (i, j, k) encodes the value of f k at cell (i, j). In other words, X (i, j, k) takes 0 if no digit is placed in (i, j), and it takes a nonzero digit n if n is placed in (i, j). The Boolean variable Y (i, j, n, k) encodes whether the set of candidates, g k (i, j), at cell (i, j) includes a nonzero digit n.
Here Y (i, j, n, k) is true if and only if n ∈ g k (i, j). We call variables of the forms X (i, j, k) and Y (i, j, n, k) X-variables and Y -variables, respectively.
The remaining variables are Boolean variables of the form Z (m), which are used for auxiliary purpose. We call them Z-variables. Each Z-variable is introduced per particular condition for a number-placement or a number-removal. The parameter m is simply an identifier for distinguishing between a large number of particular conditions. We thus number all such conditions in an arbitrary order.
By the way, since X-variables and Y -variables have k in their parameters, we have to fix the maximum number of steps, K, in advance. In principle, it suffices to let K = 649. This is shown later. Since this is too large in practice, we will propose a practical method for doing with a smaller K while keeping the exactness in Section 5.

4.2.2.
Constraints for Initial States. The constraints for initial states are as follows. For all clue cells (i, j), and for the other cells (i, j), Here we would not explicitly impose any constraint on Y -variables in step 0 because such constrains can be derived from the constraints for Y -variables of an arbitrary step and the constraints for numberremovals.

Constraints for State Transitions.
The constraints for state transitions represent how X-variables and Y -variables in the current grid are determined from the previous grid.
The constraint that allows us to determine a nonzero digit n at cell (i, j) in step k is as follows.
Here, Z (m) runs over all possible Z-variables that can derive the left hand side. The only-if part means that if X (i, j, k) = n, then there must be an evidence, i.e., some Z-variable is true. One such Z-variable is the case for which n is determined at (i, j) in the previous step.
(4) Z (m) ↔ X (i, j, k − 1) = n As noticed before, suppose that the parameter m is uniquely determined in order to distinguish the condition in the right hand side from the other particular conditions for Z-variables. Hereafter we will follow the same implicit agreement whenever Z (m) appears in constraints. The other Z-variables of Formula 3 will be detailed later according to particular cases. Notice that as discussed in Section 3 in order for our assumption for state transitions to be met, it is sufficient to let Z (m) be determined by only Y -variables in the previous step (except for Formula 4). The constraint that allows us to rule out a nonzero digit n as a candidate at cell (i, j) in step k is as follows.
In the same way as X-variables, Z (m) runs over all possible Zvariables that can derive the left hand side. One such Z-variable is the case for which n is ruled out as a candidate at (i, j) in the previous step.
The other Z-variables of Formula 5 will be detailed later according to particular cases.

Constraints for Final
States. The constraints for final states are those that allow us to reject the current state as soon as it turns out that there is no chance to reach final states. There are three cases for the current state of grid.
(2) Some empty cells remain, and some candidates have been ruled out from the previous grid. (3) Some empty cells remain, and no candidate has been ruled out from the previous grid. Clearly the first case must be accepted. For the third case, our assumption of state transitions (see Section 3) implies that the current incomplete grid cannot be changed anymore. Hence, the third case must be rejected immediately. For the second case, since applicable strategies may remain for the current grid, the decision must be postponed to the next grid. The following formula is in change of this filtration.
Suppose that the current grid is in step k (≥ 1). The left hand side means that no candidate has not been ruled out from the previous grid, and the right hand side means that the current grid is completed. It is clear that this formula rejects only the third case among the three cases.
As announced earlier, we here show that K = 649 is sufficient. Let q 0 = (f 0 , g 0 ) , . . . , q k = (f k , g k ) , . . . be any sequence of states such that q 0 is an initial state and q k is the next state of q k−1 for all k.
The assumption for state transitions (see Section 3) ensures that once gk −1 = gk for somek, it follows that qk = q k for all k ≥k. From Proposition 2, the minimumk with gk −1 = gk is bounded from above by 649. Therefore it suffices to let K = 649. Notice thatk ≤ K is necessary in order to decide whether qk is a final state.

4.3.
Constraints for Particular Number-placements. We explain particular cases for Z (m)s in Formula 3 that we have put off. 4.3.1. Naked Singles. The right hand side of the following formula is the condition for which a naked single allows us to determine a nonzero digit n at cell (i, j) in step k (≥ 1). Notice that in order for this to take effect, it is necessary that the following Z (m) is registered to Formula 3.
The right hand side means that all digits but n are ruled out as candidates at cell (i, j) in the previous step. There are two cases: either only n remains as a candidate or no digit remains. Although a naked single is applicable only to the former case, there is no substantial problem. Because even if the latter case occurs, we obtain X (i, j, k) = n from Formulas 8 and 3, and we also obtain X (i, j, k) = n for any other digit n in the same way, which is a contradiction.

Hidden Singles.
The right hand side of the following formula is the condition for which a hidden single allows us to determine a nonzero digit n at cell (i, j) in step k (≥ 1).
¬Y (i , j , n, k − 1) Here, let G be any group such that (i, j) ∈ G. There are three cases for G, and for each case the corresponding constraint must be generated from Formula 9. The right hand side of Formula 9 does not exclude the case for which n is ruled out over all cells in G, but there is no substantial problem, just like Formula 8.

4.4.
Constraints for Particular Number-removals. We in turn explain particular cases for Z (m)s in Formula 5 that we have put off.

Conditions for States of Grid.
We have imposed the two conditions S 1 and S 2 on states of grid in order to reject states that violate the rules of a Sudoku puzzle. We introduce constraints corresponding to S 1 and S 2 . Unlike the other constraints, the constraints below determine a relation between X-variables and Y -variables in the same step.
The following formula corresponds to S 1 , which ensures that all cells (i, j) have at least one candidate in all steps k ≥ 0.
(10) 1≤n≤9 Y (i, j, n, k) The following formula in turn corresponds to one of the two cases in the antecedent of S 2 , that is, a different digit n from n is determined at cell (i, j).
Here, suppose that Z (m) is registered in Formula 5. If the right hand side of Formula 11 holds, then it follows from Formulas 5 and 11 that n is ruled out as a candidate at (i, j) in the same step k, which is the consequent of S 2 .
The following formula corresponds to the other case in the antecedent of S 2 , that is, there is a different cell (i , j ) from (i, j) with both in a common group G such that n is determined at (i , j ).
Here, let G be any group such that (i, j) ∈ G. There are three cases for G, and for each case the corresponding constraint must be generated from Formula 12. Just like Formula 11, Formula 12 together with Formula 5 imply that n is ruled out as a candidate at (i, j) in the same step k, which is the consequent of S 2 .

Locked
Candidates. The right hand side of the following formula is the condition for which a locked candidate allows us to rule out a nonzero digit n at cell (i, j) in step k (≥ 1).
Here, let A and B be any groups such that (i, j) ∈ B\A and |A∩B| = 3. For all possible combinations of A and B, the corresponding constraint must be generated from Formula 13. Notice that Formula 13 can be commonly used to deduce Y (i , j , n, k) for all (i , j ) ∈ B \ A, by which the size of constraints can be largely reduced.

4.5.
Remarks. We have presented a CSP encoding for the strategysolvable Sudoku clues problem. That is, given a set of cells, there are clues for the cells such that the grid can be completed using naked singles, hidden singles, and locked candidates if and only if there is an assignment of X-variables, Y -variables, and Z-variables that satisfies all the constraints generated from Formulas 1 to 13. A satisfying assignment substantially corresponds to a sequence of states q 0 , . . . , q k with q 0 strategy-solvable, as characterized in Definition 3.1. By applying a CSP solver to the encoded constraints, we eventually obtain strategysolvable Sudoku clues if exist; otherwise, we eventually recognize the strategy-unsolvability of the clue cells, that is, no assignment of digits to the clue cells is strategy-solvable. The constraints for a general state transition framework are almost independent of particular strategies. The only connection is via Z-variables in Formulas 3 and 5. In order to include additional strategies, it is sufficient to model these strategies as logical formulas independently and then register new Z-variables for them to Formulas 3 or 5.

Two Improvements
In this section, we present two improvements for our method.

5.1.
Reduction of Constraint Size. The biggest issue of our method is that there are hundreds of thousands of constraints. A simple way for reducing a constraint size is to eliminate constraints concerning clue cells. For all clue cells, digits are determined in an initial state, and the determined digits do not change over all succeeding steps. Hence, all constraints necessary for clue cells in each step is take the same values as those in the previous step. In the constraints for final states, there is no need to examine the values of X-variables and Y -variables for clue cells. However, we must not ignore the constraints for clue cells in step 0 corresponding to Formulas 10, 11, and 12 because otherwise, we could not reject initial states violating the rules of Sudoku puzzle.

Incremental Approach.
Our method requires to fix a maximum step size, K, in advance. Since it has a significant impact on a constraint size, K needs to be as small as possible. However, for a small K, our method may return false clues. To see this, let us take a look at Figure 3. Suppose that the left grid is an initial state and the right grid is a state in step K. The right grid is not yet completed, but no constraint has been violated up to step K. Since there is no further step, our method returns the initial grid, even if only a naked single strategy is allowed. Notice that if the right grid was in step K − 1 or less, our method would reject the initial grid (because the constraints for final states are violated). We propose a practical method for doing with a smaller K while keeping the exactness. A basic idea is to repeatedly apply our original method while incrementing K from an initial number K min until K exceeds a sufficiently large number K max . Algorithm 1 is a pseudo code for the method. Notice that once constraints become unsatisfiable, constraints with any lager maximum step size must be unsatisfiable.

Algorithm 1 Incremental approach for the strategy-solvable Sudoku clues (SSC)
for K = K min to K max do Generate constraints for a given SSC instance with maximum step K.
if the set of constraints is unsatisfiable then return UNSAT else if the grid in step K is completed then return Sudoku clues in the initial grid. end if end for

Application
Besides the clue generation, we present an application of our method to the problem of determining the minimum number of Sudoku clues that are solvable with a given set of strategies.
Our method is easily customized with a small modification as follows. Remove Formulas 1 and 2. Instead, introduce integer variables taking 0 or 1, U (i, j), for all cells (i, j) and the following formula.
Introduce the following formula for ensuring that the number of determined digits in step 0 is less than or equal to a threshold θ.
Here the summation runs over all variables U (i, j).
In order to compute the minimum number, it is sufficient to repeatedly solve the modified constraints while decreasing θ one by one until the constraints become unsatisfiable.

Experiments
In this section, we conduct experiments to evaluate our method. The implementation of our method is checked for all possible arrangements of 3 and 4 clue positions for 4 × 4 Sudoku. These instances are so small that a naive brute force search can quickly decide. It is confirmed that the solvability results for our method completely coincide with those for the brute force search over all instances. Here all strategies allowed to be used are naked singles, hidden singles, and locked candidates. It turns out that there is no strategy-solvable instance with 3 clue positions, and there are exactly 704 strategy-solvable instances with 4 clue positions. By the way, all of the 704 instances are also solvable with naked singles only. Since there is no proper 4 × 4 Sudoku with 3 clues, there is no gap between the minimum numbers of proper Sudokus and strategy-solvable Sudokus with naked singles.
The implementation of (the CSP encoding part of) our method, tools such as the brute force search program, and all instances used in the experiments are publicly available in our website 2 . 7.2. Running Time Comparison. We compare our CSP-based method (CSP) with the generator of Zama and Sasano [9] (ZS). The time limit is set to 600 seconds. In both methods, only naked singles, hidden singles, and locked candidates are allowed to be used. Although other strategies are implemented in the generator of Zama and Sasano, we restricts the program to the three strategies by modifying their program.
We make total 100 input instances (i.e. sets of cells) by repeating the following procedure: select a number n from 20 to 79 at random, and generate distinct n cells at random. Table 1 shows the distribution of input instances with respect to the number of clues. All instances are confirmed to be strategy-solvable. Our method solves 95 of total 100 instances within the time limit, while the generator of Zama and Sasano solves 65 instances. The curve of our method shows a linear increase up to around 90 in the x-axis. All instances in this range are solved within about 1 minutes. The curve grows rapidly after 90. All instances in this rage as well as unsolved instances have 25 or less cells.
On the other hand, the generator of Zama and Sasano often can find solutions much faster even in near 20 cells as the curve of Zama-Sasano almost overlaps the x-axis up to near 60. All instances in this range have around 45 or less cells. After that, the performance drops significantly around 60 as the curve sharply increases. All instances with 50 or more cells cannot be solved within the time limit. 7.3. Evaluation on Unsolvability. To see the efficiency for deciding unsolvablity, we make instances which seem to be on the border between solvable cases and unsolvable cases in such a way that we randomly select 30 minimum Sudokus from the collection of Gordon F. Royle [6] and extract only clue positions, simply forgetting placed digits. In this experiment, all strategies allowed to be used are naked singles only. Notice that although no grid solvable with naked singles is included in the collection, it is possible that changing digits but in the same positions makes grids solvable.
Within several hours, our method terminates for 14 of the 30 instances, and all of them are confirmed to be not strategy-solvable. Tables 2 and 3 in Appendix show the chosen minimum Sudokus and the running times. Although 10 instances take merely from 10 to 20 minutes, other instances take much more time. It is still unknown whether there are 17 clues solvable with naked singles only. It appears far from the settlement of the problem on a gap betwen the numbers of strategy-solvable Sudokus and proper Sudokus by a computer program, considering a large number of possible arrangements of 17 positions.

Conclusion
Sudokus that appear in books, newspapers, etc often have a regular pattern in the arrangement of initial digits and they are typically made so that all empty cells can be completed using some known techniques, called strategies. We formally defined the problem of generating such Sudoku instances by introducing the concept of strategy-solvability, which means that all empty cell can be filled in with digits using only a given set of strategies. We proposed an exact method for solving this problem. The key is to encode a given problem instance into an equivalent CSP instance and then solve it by applying a CSP solver.
There are a few existing researches, but all of them are based on the generate-and-test method, which repeats to generate a set of clues and then test whether it is strategy-solvable. There are some drawbacks such as not being able to recognize that a specified set of cells is strategy-unsolvable.
To the best of our knowledge, our method is the first exact method except for the trivial brute-force search. Our method eventually can find strategy-solvable Sudoku clues if exist, and otherwise, our method eventually can recognize strategy-unsolvability. Besides the clue generation, we presented an application of our method to the problem of determining the minimum number of strategy-solvable Sudoku clues, demonstrating that our method is easily customized with a small modification.
We conducted experiments to compare our method with the generator of Zama and Sasano, using grids varying the positions and the numbers of clues at random. From the results we observed that our method terminated within 1 minutes for many grids, showing our method being stable in terms of running time. However, as the number of clues got closer to 20, the running time rapidly increased and exceeded the time limit, which is set to 600 seconds. On the other hand, the generator of Zama and Sasano often could find solutions much faster even in near 20 clues, while the performance sharply deteriorated around 45 clues and exceeded the time limit for all grids with more clue positions. We also evaluated our method for several instances with 17 clue positions taken from known minimum Sudokus to see the efficiency for deciding unsolvability. It remains as future work to improve our method in less clues.