forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all_interval4.fzn
59 lines (59 loc) · 4.59 KB
/
all_interval4.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
52
53
54
55
56
57
58
59
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 0..11: INT____00002 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00003 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00004 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00005 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00006 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00007 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00008 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00009 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00010 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00011 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00012 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00013 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00014 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00015 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00016 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00017 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00018 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00019 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00020 :: is_defined_var :: var_is_introduced;
var -11..11: INT____00021 :: is_defined_var :: var_is_introduced;
var 0..11: INT____00022 :: is_defined_var :: var_is_introduced;
array [1..12] of var 0..11: series :: output_array([0..11]);
constraint all_different_int([INT____00002, INT____00004, INT____00006, INT____00008, INT____00010, INT____00012, INT____00014, INT____00016, INT____00018, INT____00020, INT____00022]);
constraint all_different_int(series);
constraint int_abs(INT____00001, INT____00002) :: defines_var(INT____00002);
constraint int_abs(INT____00003, INT____00004) :: defines_var(INT____00004);
constraint int_abs(INT____00005, INT____00006) :: defines_var(INT____00006);
constraint int_abs(INT____00007, INT____00008) :: defines_var(INT____00008);
constraint int_abs(INT____00009, INT____00010) :: defines_var(INT____00010);
constraint int_abs(INT____00011, INT____00012) :: defines_var(INT____00012);
constraint int_abs(INT____00013, INT____00014) :: defines_var(INT____00014);
constraint int_abs(INT____00015, INT____00016) :: defines_var(INT____00016);
constraint int_abs(INT____00017, INT____00018) :: defines_var(INT____00018);
constraint int_abs(INT____00019, INT____00020) :: defines_var(INT____00020);
constraint int_abs(INT____00021, INT____00022) :: defines_var(INT____00022);
constraint int_lin_eq([-1, -1, 1], [INT____00001, series[1], series[2]], 0) :: defines_var(INT____00001);
constraint int_lin_eq([-1, -1, 1], [INT____00003, series[2], series[3]], 0) :: defines_var(INT____00003);
constraint int_lin_eq([-1, -1, 1], [INT____00005, series[3], series[4]], 0) :: defines_var(INT____00005);
constraint int_lin_eq([-1, -1, 1], [INT____00007, series[4], series[5]], 0) :: defines_var(INT____00007);
constraint int_lin_eq([-1, -1, 1], [INT____00009, series[5], series[6]], 0) :: defines_var(INT____00009);
constraint int_lin_eq([-1, -1, 1], [INT____00011, series[6], series[7]], 0) :: defines_var(INT____00011);
constraint int_lin_eq([-1, -1, 1], [INT____00013, series[7], series[8]], 0) :: defines_var(INT____00013);
constraint int_lin_eq([-1, -1, 1], [INT____00015, series[8], series[9]], 0) :: defines_var(INT____00015);
constraint int_lin_eq([-1, -1, 1], [INT____00017, series[9], series[10]], 0) :: defines_var(INT____00017);
constraint int_lin_eq([-1, -1, 1], [INT____00019, series[10], series[11]], 0) :: defines_var(INT____00019);
constraint int_lin_eq([-1, -1, 1], [INT____00021, series[11], series[12]], 0) :: defines_var(INT____00021);
solve :: int_search(series, first_fail, indomain_median, complete) satisfy;