-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathqueens.mzn
36 lines (29 loc) · 1.33 KB
/
queens.mzn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
int: n; % The number of queens.
array [1..n] of var 1..n: q;
include "alldifferent.mzn";
constraint alldifferent(q);
constraint alldifferent(i in 1..n)(q[i] + i);
constraint alldifferent(i in 1..n)(q[i] - i);
solve
% :: int_search(q, input_order, indomain_min, complete)
% :: int_search(q, first_fail, indomain_min, complete)
% :: int_search(q, smallest, indomain_min, complete)
% :: int_search(q, largest, indomain_min, complete)
% :: int_search(q, input_order, indomain_max, complete)
% :: int_search(q, first_fail, indomain_max, complete)
% :: int_search(q, smallest, indomain_max, complete)
% :: int_search(q, largest, indomain_max, complete)
% :: int_search(q, input_order, indomain_median, complete)
% :: int_search(q, first_fail, indomain_median, complete)
% :: int_search(q, smallest, indomain_median, complete)
% :: int_search(q, largest, indomain_median, complete)
% :: int_search(q, input_order, indomain_random, complete)
% :: int_search(q, first_fail, indomain_random, complete)
% :: int_search(q, smallest, indomain_random, complete)
% :: int_search(q, largest, indomain_random, complete)
satisfy;
%output
%% [ if fix(q[i]) = j then "Q " else ". " endif ++
% if j = n then "\n" else "" endif
% | i, j in 1..n
% ];