forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
babysitting.fzn
36 lines (36 loc) · 2.02 KB
/
babysitting.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
predicate fzn_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_fzn_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_fzn_cumulative(array [int] of var int: s, array [int] of int: d, array [int] of int: r, var int: b);
array [1..5] of int: first = [1, 2, 3, 4, 5];
var 1..5: Fell;
var 1..5: Gant;
var 1..5: Hall;
var 3..6: INT____00002 :: is_defined_var :: var_is_introduced;
var 5..6: INT____00004 :: is_defined_var :: var_is_introduced;
var 2..6: INT____00005 :: is_defined_var :: var_is_introduced;
var 1..5: Ivey;
var 2..2: Jule = 2;
array [1..5] of var 2..6: age :: output_array([1..5]);
array [1..5] of var 1..5: last :: output_array([1..5]) = [Fell, Gant, Hall, Ivey, 2];
constraint fzn_all_different_int(age);
constraint fzn_all_different_int(last);
constraint array_var_int_element(Fell, age, INT____00004);
constraint array_var_int_element(Hall, age, INT____00005) :: defines_var(INT____00005);
constraint array_var_int_element(Ivey, age, INT____00002);
constraint int_lin_eq([-2, 1], [INT____00005, age[5]], 0);
constraint int_lin_eq([-1, 1], [INT____00002, age[1]], 1);
constraint int_lin_eq([-1, 1], [INT____00002, age[4]], -1) :: defines_var(INT____00002);
constraint int_lin_eq([-1, 1], [INT____00004, age[3]], -3) :: defines_var(INT____00004);
constraint int_ne(1, Ivey);
constraint int_ne(5, Hall);
constraint int_ne(Fell, 3);
constraint int_ne(Ivey, 4);
solve satisfy;