this repo has no description
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3% RUNS ON mzn20_fd_linear 4% RUNS ON mzn20_mip 5% 6%-----------------------------------------------------------------------------% 7% Sudoku for squares of arbitrary size N = (S x S) 8%-----------------------------------------------------------------------------% 9 10int: S; 11int: N = S * S; 12 13 14array[1..N,1..N] of var 1..N: puzzle; 15 16 17include "alldifferent.mzn"; 18 19 % All cells in a row, in a column, and in a subsquare are different. 20constraint 21 forall(i in 1..N)( alldifferent(j in 1..N)( puzzle[i,j] )) 22 /\ 23 forall(j in 1..N)( alldifferent(i in 1..N)( puzzle[i,j] )) 24 /\ 25 forall(i,j in 1..S) 26 ( alldifferent(p,q in 1..S)( puzzle[S*(i-1)+p, S*(j-1)+q] )); 27 28 29solve satisfy; 30 31 32output [ "sudoku:\n" ] ++ 33 [ show(puzzle[i,j]) ++ 34 if j = N then 35 if i mod S = 0 /\ i < N then "\n\n" else "\n" endif 36 else 37 if j mod S = 0 then " " else " " endif 38 endif 39 | i,j in 1..N ]; 40 41%-----------------------------------------------------------------------------% 42% 43% The data for the puzzle that causes satz to make 1 backtrack (normally none 44% are made). 45% 46 47S=3; 48puzzle=[| 49_, _, _, _, _, _, _, _, _| 50_, 6, 8, 4, _, 1, _, 7, _| 51_, _, _, _, 8, 5, _, 3, _| 52_, 2, 6, 8, _, 9, _, 4, _| 53_, _, 7, _, _, _, 9, _, _| 54_, 5, _, 1, _, 6, 3, 2, _| 55_, 4, _, 6, 1, _, _, _, _| 56_, 3, _, 2, _, 7, 6, 9, _| 57_, _, _, _, _, _, _, _, _| 58|]; 59