this repo has no description
1int: n; % 拉丁方的大小
2array[1..n,1..n,1..n] of var bool: a;
3
4predicate atmostone(array[int] of var bool:x) =
5 forall(i,j in index_set(x) where i < j)(
6 (not x[i] \/ not x[j]));
7predicate exactlyone(array[int] of var bool:x) =
8 atmostone(x) /\ exists(x);
9
10constraint forall(i,j in 1..n)(
11 exactlyone(k in 1..n)(a[i,j,k]) /\
12 exactlyone(k in 1..n)(a[i,k,j]) /\
13 exactlyone(k in 1..n)(a[k,i,j])
14 );
15solve satisfy;
16output [ if fix(a[i,j,k]) then
17 show(k) ++ if j == n then "\n" else " " endif
18 else "" endif | i,j,k in 1..n ];