|
| 1 | +% Excerpt of Google OR-Tools (https://github.com/google/or-tools/) |
| 2 | +% License: Apache 2.0 (https://github.com/google/or-tools/blob/stable/LICENSE-2.0.txt) |
| 3 | +% Original file: https://github.com/google/or-tools/blob/stable/examples/flatzinc/puzzle1.fzn |
| 4 | +array [1..16] of int: clues = [5, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 8, 0, 7, 0, 0]; |
| 5 | +array [1..4] of int: colsums = [24, 18, 31, 31]; |
| 6 | +array [1..2] of int: diagsums = [24, 24]; |
| 7 | +array [1..4] of int: rowsums = [22, 26, 31, 25]; |
| 8 | +array [1..16] of var 1..9: x :: output_array([1..4, 1..4]); |
| 9 | +constraint int_eq(5, x[1]); |
| 10 | +constraint int_eq(7, x[14]); |
| 11 | +constraint int_eq(8, x[7]); |
| 12 | +constraint int_eq(8, x[12]); |
| 13 | +constraint int_lin_eq([1, 1, 1, 1], [x[1], x[2], x[3], x[4]], 22); |
| 14 | +constraint int_lin_eq([1, 1, 1, 1], [x[1], x[5], x[9], x[13]], 24); |
| 15 | +constraint int_lin_eq([1, 1, 1, 1], [x[1], x[6], x[11], x[16]], 24); |
| 16 | +constraint int_lin_eq([1, 1, 1, 1], [x[2], x[6], x[10], x[14]], 18); |
| 17 | +constraint int_lin_eq([1, 1, 1, 1], [x[3], x[7], x[11], x[15]], 31); |
| 18 | +constraint int_lin_eq([1, 1, 1, 1], [x[4], x[7], x[10], x[13]], 24); |
| 19 | +constraint int_lin_eq([1, 1, 1, 1], [x[4], x[8], x[12], x[16]], 31); |
| 20 | +constraint int_lin_eq([1, 1, 1, 1], [x[5], x[6], x[7], x[8]], 26); |
| 21 | +constraint int_lin_eq([1, 1, 1, 1], [x[9], x[10], x[11], x[12]], 31); |
| 22 | +constraint int_lin_eq([1, 1, 1, 1], [x[13], x[14], x[15], x[16]], 25); |
| 23 | +solve satisfy; |
0 commit comments