Loading [Contrib]/a11y/accessibility-menu.js
Download
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
%
% Magic Hexagon in MiniZinc.
%
% Prob023: Magic Hexagon
% http://www.cse.unsw.edu.au/~tw/csplib/prob/prob023/
%
 
%
% Model created by Hakan Kjellerstrand, hakank@bonetmail.com
% See also my MiniZinc page: http://www.hakank.org/minizinc
%
 
include "globals.mzn";
 
set of int: N = 1..19;
var N: a;
var N: b;
var N: c;
var N: d;
var N: e;
var N: f;
var N: g;
var N: h;
var N: i;
var N: j;
var N: k;
var N: l;
var N: m;
var N: n;
var N: o;
var N: p;
var N: q;
var N: r;
var N: s;
 
array[N] of var N: LD = [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s];
 
solve satisfy;
 
constraint
  all_different(LD) /\
 
  a + b + c =  38 /\
  d + e + f + g =  38 /\
  h + i + j + k + l =  38 /\
  m + n + o + p =  38 /\
  q + r + s =  38 /\
  a + d + h =  38 /\
  b + e + i + m =  38 /\
  c + f + j + n + q =  38 /\
  g + k + o + r =  38 /\
  l + p + s =  38 /\
  c + g + l =  38 /\
  b + f + k + p =  38 /\
  a + e + j + o + s =  38 /\
  d + i + n + r =  38 /\
  h + m + q =  38 /\
 
  a < c /\
  a < h /\
  a < l /\
  a < q /\
  a < s /\
  c < h
;
 
output
[
  show(LD)
];