this repo has no description
1% RUNS ON mzn20_fd
2% RUNS ON mzn-fzn_fd
3% RUNS ON mzn20_fd_linear
4% RUNS ON mzn20_mip
5%------------------------------------------------------------------------%
6% Golomb rulers
7% prob006 in csplib
8%------------------------------------------------------------------------%
9% From csplib:
10% A Golomb ruler may be defined as a set of m integers 0 = a_1 < a_2 <
11% ... < a_m such that the m(m-1)/2 differences a_j - a_i, 1 <= i < j
12% <= m are distinct. Such a ruler is said to contain m marks and is of
13% length a_m. The objective is to find optimal (minimum length) or
14% near optimal rulers.
15%
16% This is the "ternary constraints and an alldifferent" model
17%------------------------------------------------------------------------%
18
19include "globals.mzn";
20
21int: m = 4;
22int: n = m*m;
23
24array[1..m] of var 0..n: mark;
25
26array[int] of var 0..n: differences =
27 [ mark[j] - mark[i] | i in 1..m, j in i+1..m];
28
29constraint mark[1] = 0;
30
31constraint forall ( i in 1..m-1 ) ( mark[i] < mark[i+1] );
32
33constraint alldifferent(differences);
34
35 % Symmetry breaking
36constraint differences[1] < differences[(m*(m-1)) div 2];
37
38solve :: int_search(mark, input_order, indomain, complete)
39 minimize mark[m];
40
41output ["golomb ", show(mark), "\n"];