12
$\begingroup$

The usual rules of sudoku apply: each row and column must have one of each digit; plus, if you divide the whole nine-by-nine grid into nine three-by-three subgrids, then each subgrid has one of each digit. Special for this sudoku, though, some areas are heavily outlined; each of these must contain precisely the digits printed in it, with the same multiplicity.


By request, the blank grid:

$\endgroup$
1
7
$\begingroup$

This is my solution:

solution

My approach was fairly simple:
1. Note down the possible digits for each cell, according to the rules.
2. Solve it like a usual Sudoku.

Here are the basic steps:

Put all the possible digits in the outlined areas according to the question:
enter image description here
Digits that appear multiple times inside one area and therefore must exist at a specific position:
enter image description here
Following the general Sudoku rules (specificly: unique digits in column, row and subgrids):
enter image description here
Some more deduction using the general Sudoku rules:
enter image description here
Continue to solve the Sudoku.

$\endgroup$
13
  • 2
    $\begingroup$ Could you provide any more detail for your solution path? Even just some key deductions with pictures would be nice. Solutions to [grid-deduction] questions are generally expected to explain their solution path. $\endgroup$
    – bobble
    Dec 17 '20 at 17:45
  • $\begingroup$ @bobble Yes, I thought about that. But I actually did nothing more than draw a blank Sudoku, put all the possible digits in the outlined areas according to the question, and then solved the puzzle like a normal Sudoku. $\endgroup$
    – npkllr
    Dec 17 '20 at 17:49
  • $\begingroup$ Would it be possible to show any interesting steps, or even just several picture of intermediate states? $\endgroup$
    – bobble
    Dec 17 '20 at 17:50
  • 1
    $\begingroup$ @npkllr, yes this is better. Thank you for adding more explanation $\endgroup$
    – bobble
    Dec 17 '20 at 18:31
  • 1
    $\begingroup$ @JeremyDover I added an answer that describes the constraint programming formulation. $\endgroup$
    – RobPratt
    Dec 17 '20 at 20:49
0
$\begingroup$

You can solve the problem via constraint programming as follows. For each cell $(i,j)$, let integer decision variable $x_{i,j} \in [1,9]$ be the digit that appears in that cell. The usual sudoku rules yield 27 ALLDIFF constraints, one per row, column, or 3-by-3 box. For example, the ALLDIFF constraint for row 1 is $$\operatorname{ALLDIFF}(x_{1,1}, x_{1,2}, x_{1,3}, x_{1,4}, x_{1,5}, x_{1,6}, x_{1,7}, x_{1,8}, x_{1,9}),$$ the ALLDIFF constraint for column 1 is $$\operatorname{ALLDIFF}(x_{1,1}, x_{2,1}, x_{3,1}, x_{4,1}, x_{5,1}, x_{6,1}, x_{7,1}, x_{8,1}, x_{9,1}),$$ and the ALLDIFF constraint for the top left 3-by-3 box is $$\operatorname{ALLDIFF}(x_{1,1}, x_{1,2}, x_{1,3}, x_{2,1}, x_{2,2}, x_{2,3}, x_{3,1}, x_{3,2}, x_{3,3}).$$ For each of the 18 regions, there is also a global cardinality constraint (GCC). For example, the central plus-shaped region requires $$\operatorname{GCC}(x_{3,5}, x_{4,5}, x_{5,3}, x_{5,4}, x_{5,5}, x_{5,6}, x_{5,7}, x_{6,5}, x_{7,5}; \{(2,1,1), (3,1,1), (4,1,1), (5,1,1), (7,1,1), (8,2,2), (9,2,2)\}).$$ The interpretation is that the seven variables in the first argument must together take the values 2, 3, 4, 5, and 7 once each and the values 8 and 9 twice each.

$\endgroup$
3
  • $\begingroup$ I don't think a programming answer is helpful when the given puzzle is already shown to be solvable by hand with logic. $\endgroup$
    – Bubbler
    Dec 17 '20 at 23:48
  • $\begingroup$ Hmm, I thought multiple approaches were encouraged. $\endgroup$
    – RobPratt
    Dec 18 '20 at 14:20
  • 1
    $\begingroup$ @Bubbler I see your point, but this is not just "I wrote a python script". Rather it is a mathematical formulation that I appreciate learning more about. $\endgroup$ Dec 19 '20 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.