Files
ortools-clone/examples/flatzinc/building_blocks.fzn

28 lines
2.1 KiB
MiniZinc
Raw Permalink Normal View History

predicate fzn_all_different_int(array [int] of var int: x);
2012-09-03 18:26:36 +00:00
predicate count(array [int] of var int: x, var int: y, var int: c);
predicate fixed_fzn_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, int: b);
2012-09-03 18:26:36 +00:00
predicate global_cardinality(array [int] of var int: x, array [int] of int: cover, array [int] of var int: counts);
predicate maximum_int(var int: m, array [int] of var int: x);
predicate minimum_int(var int: m, array [int] of var int: x);
predicate sliding_sum(int: low, int: up, int: seq, array [int] of var int: vs);
predicate sort(array [int] of var int: x, array [int] of var int: y);
predicate table_bool(array [int] of var bool: x, array [int, int] of bool: t);
predicate table_int(array [int] of var int: x, array [int, int] of int: t);
predicate var_fzn_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, var int: b);
2012-09-03 18:26:36 +00:00
array [1..48] of int: words = [2, 1, 11, 5, 15, 14, 24, 23, 5, 3, 8, 15, 15, 21, 1, 12, 7, 9, 17, 4, 18, 13, 20, 7, 10, 20, 13, 16, 19, 15, 17, 14, 12, 20, 3, 11, 21, 9, 14, 24, 12, 20, 18, 8, 22, 17, 1, 16];
array [1..24] of var 1..4: dice :: output_array([1..24]);
constraint fzn_all_different_int([dice[2], dice[1], dice[11], dice[5]]);
constraint fzn_all_different_int([dice[5], dice[3], dice[8], dice[15]]);
constraint fzn_all_different_int([dice[7], dice[9], dice[17], dice[4]]);
constraint fzn_all_different_int([dice[10], dice[20], dice[13], dice[16]]);
constraint fzn_all_different_int([dice[12], dice[20], dice[3], dice[11]]);
constraint fzn_all_different_int([dice[12], dice[20], dice[18], dice[8]]);
constraint fzn_all_different_int([dice[15], dice[14], dice[24], dice[23]]);
constraint fzn_all_different_int([dice[15], dice[21], dice[1], dice[12]]);
constraint fzn_all_different_int([dice[18], dice[13], dice[20], dice[7]]);
constraint fzn_all_different_int([dice[19], dice[15], dice[17], dice[14]]);
constraint fzn_all_different_int([dice[21], dice[9], dice[14], dice[24]]);
constraint fzn_all_different_int([dice[22], dice[17], dice[1], dice[16]]);
2012-09-03 18:26:36 +00:00
constraint global_cardinality(dice, [1, 2, 3, 4], [6, 6, 6, 6]);
solve satisfy;