this repo has no description
at develop 2.1 kB view raw
1% RUNS ON mzn20_fd 2% RUNS ON mzn-fzn_fd 3% RUNS ON mzn20_mip 4%% Bennett quasigroup existence problem (QG5). 5%% 6%% A quasigroup is just a groupoid whose "multiplication table" is a 7%% Latin square: each row and each column is a permutation of the 8%% elements. Bennett's equation (not invented by Frank Bennett but 9%% studied by him) is (yx.y)y = x which forces the quasigroup to have 10%% interesting properties such as being orthogonal to certain of its 11%% conjugates. Idempotent ones are more important than the others. 12%% 13%% Bennett quasigroups exist for all positive N except for 2, 6, 10 14%% and with the possible exceptions of 14, 18, 26, 30, 38, 42 and 158. 15%% 16%% Idempotent ones exist for all positive N not in {2, 3, 4, 6, 9, 10, 17%% 12, 13, 14, 15, 16} except possibly for N in {18, 20, 22, 24, 26, 18%% 28, 30, 34, 38, 39, 42, 44, 46, 51, 52, 58, 60, 62, 66, 68, 70, 72, 19%% 74, 75, 76, 86, 87, 90, 94, 96, 98, 99, 100, 102, 106, 108, 110, 20%% 114, 116, 118, 122, 132, 142, 146, 154, 158, 164, 170, 174} 21%% 22%% The existence of smallish open problems makes this algebraic 23%% question attractive from the viewpoint of automated reasoning and 24%% constraint satisfaction. 25%% 26%% Reference: 27%% F. E. Bennett 28%% Quasigroups 29%% C. J. Colbourn (ed) 30%% The CRC Handbook of Combinatorial Designs 31%% Chapter 36, pp .424-429. 32 33include "globals.mzn"; 34 35int: N; 36 37array[1..N,1..N] of var 1..N: q; 38 39constraint 40 forall( x in 1..N ) 41 ( q[x, x] = x ); 42 43constraint 44 forall( x in 1..N ) 45 ( alldifferent([q[x,y] | y in 1..N]) ); 46 47constraint 48 forall( y in 1..N ) 49 ( alldifferent([q[x,y] | x in 1..N]) ); 50 51constraint 52 forall( x in 1..N ) 53 ( q[x, 1] < x + 2 ); 54 55constraint 56 forall( x in 1..N, y in 1..N ) 57 ( q[q[q[y, x], y], y] = x ); 58 59solve :: int_search(array1d(1..N*N, q), input_order, indomain, complete) 60 satisfy; 61 62output ["Bennett quasigroup of size " ++ show(N) ++ ":\n"] ++ 63 [ if y=1 then "\n " else " " endif ++ show(q[x,y]) | x,y in 1..N ] ++ 64 [ "\n" ]; 65 66N = 5; % Solutions also exist for N=7, N=8 and N=11.