4d26a735
Pedro Roque
Increased recogni...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
%% schurs numbers
%%
%% determine if n balls labelled 1..n
%% can be placed in c boxes with no box containing a triple {x,y,z} where x+y=z
%
% http://www.csplib.org/Problems/prob015/models/schur.mzn
int: n; %% number of balls
int: c; %% number of boxes
array[1..n] of var 1..c: box;
constraint forall(i in 1..n-1, j in i+1 .. n - i)(
box[i] != box[j] \/
box[i] != box[i+j] \/
box[j] != box[i+j]);
%solve satisfy;
solve :: int_search(box, input_order, indomain_min, complete) satisfy;
output ["n = ", show(n), ";\nc = ", show(c), ";\nbox = ",show(box),";\n"];
|