How to show unique sodoku solution

Given the unresolved sodoku, how can one show that he has a unique solution?

+4
source share
6 answers

Try to find two solutions.

The simplest algorithm is brute force recursive countdown algorithm . Once you find the first solution, step back and find the second. This is slow, but (unlike algorithms based only on logic), the ability to find all solutions in the end is guaranteed. Therefore, if this algorithm ends up finding only one solution, then this solution must be unique.

, . , , .

- . . , , , . , , , , , .

, , . :

    • ....
+3

, , :

* *  *  | * * * | * * *
* *  *  | * * * | * * *
* 12 12 | * * * | * * *
--------+-------+------
* *  *  | * * * | * * *
* *  *  | * * * | * * *
* 12 12 | * * * | * * *
--------+-------+------
* *  *  | * * * | * * *
* *  *  | * * * | * * *
* *  *  | * * * | * * *

* s , 12 . :

* * * | * * * | * * *    * * * | * * * | * * *
* * * | * * * | * * *    * * * | * * * | * * *
* 1 2 | * * * | * * *    * 2 1 | * * * | * * *
------+-------+------    ------+-------+------
* * * | * * * | * * *    * * * | * * * | * * *
* * * | * * * | * * *    * * * | * * * | * * *
* 2 1 | * * * | * * *    * 1 2 | * * * | * * *
------+-------+------    ------+-------+------
* * * | * * * | * * *    * * * | * * * | * * *
* * * | * * * | * * *    * * * | * * * | * * *
* * * | * * * | * * *    * * * | * * * | * * *

, , Sudoku . , , ; , .

, , . Sudoku , , Sudoku , Sudoku .

+3

Soduko - CSP 81, . A1 A9 ( ) I1-I9 . {1,2,3,4,5,6,7,8,9} , . 27 " ", , 9.

AC-3 PC-2 , .

+2

-, - . ( - 100% "" ), , . , , , - bruteforce , .

0

C- SUDOKU. , . , ...!

, 81 (9x9 ). .. , 2 81. ( - ". ", - ". ").

0

As mentioned above, a brute force recursive brute force algorithm can be used. I would suggest simply applying the algorithm twice up once; which means that the candidate values ​​increase during the search, and then using the algorithm downward, which means that the candidate values ​​are checked in descending order from the maximum possible number to 1, then at least two solutions can be detected. If the results of the upward and downward approaches remain the same, then we can say that the puzzle has a unique solution.

0
source

Source: https://habr.com/ru/post/1793283/


All Articles