forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all_interval.fzn
51 lines (51 loc) · 3.4 KB
/
all_interval.fzn
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
predicate all_different_int(array [int] of var int: x);
predicate count(array [int] of var int: x, var int: y, var int: c);
predicate fixed_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, int: b);
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_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, var int: b);
var -11..11: INT____00001 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00003 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00005 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00007 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00009 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00011 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00013 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00015 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00017 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00019 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00021 :: is_defined_var :: var_is_introduced;
array [1..11] of var 1..11: diffs;
array [1..12] of var 1..12: x :: output_array([1..12]);
constraint all_different_int(diffs) :: domain;
constraint all_different_int(x) :: domain;
constraint int_abs(INT____00001, diffs[1]);
constraint int_abs(INT____00003, diffs[2]);
constraint int_abs(INT____00005, diffs[3]);
constraint int_abs(INT____00007, diffs[4]);
constraint int_abs(INT____00009, diffs[5]);
constraint int_abs(INT____00011, diffs[6]);
constraint int_abs(INT____00013, diffs[7]);
constraint int_abs(INT____00015, diffs[8]);
constraint int_abs(INT____00017, diffs[9]);
constraint int_abs(INT____00019, diffs[10]);
constraint int_abs(INT____00021, diffs[11]);
constraint int_lin_eq([-1, -1, 1], [INT____00001, x[1], x[2]], 0) :: defines_var(INT____00001);
constraint int_lin_eq([-1, -1, 1], [INT____00003, x[2], x[3]], 0) :: defines_var(INT____00003);
constraint int_lin_eq([-1, -1, 1], [INT____00005, x[3], x[4]], 0) :: defines_var(INT____00005);
constraint int_lin_eq([-1, -1, 1], [INT____00007, x[4], x[5]], 0) :: defines_var(INT____00007);
constraint int_lin_eq([-1, -1, 1], [INT____00009, x[5], x[6]], 0) :: defines_var(INT____00009);
constraint int_lin_eq([-1, -1, 1], [INT____00011, x[6], x[7]], 0) :: defines_var(INT____00011);
constraint int_lin_eq([-1, -1, 1], [INT____00013, x[7], x[8]], 0) :: defines_var(INT____00013);
constraint int_lin_eq([-1, -1, 1], [INT____00015, x[8], x[9]], 0) :: defines_var(INT____00015);
constraint int_lin_eq([-1, -1, 1], [INT____00017, x[9], x[10]], 0) :: defines_var(INT____00017);
constraint int_lin_eq([-1, -1, 1], [INT____00019, x[10], x[11]], 0) :: defines_var(INT____00019);
constraint int_lin_eq([-1, -1, 1], [INT____00021, x[11], x[12]], 0) :: defines_var(INT____00021);
constraint int_lt(diffs[1], diffs[2]);
constraint int_lt(x[1], x[11]);
solve :: int_search(x, max_regret, indomain_split, complete) satisfy;