forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
a_round_of_golf.fzn
64 lines (64 loc) · 3.69 KB
/
a_round_of_golf.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
60
61
62
63
64
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);
array [1..4] of int: first_name = [1, 2, 3, 4];
var bool: BOOL____00005 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00007 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00008 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00009 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00010 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00011 :: is_defined_var :: var_is_introduced;
var 1..4: Carter;
var 1..4: Clubb;
var 1..4: Green;
var 70..85: INT____00002 :: is_defined_var :: var_is_introduced;
var 80..85: INT____00003 :: is_defined_var :: var_is_introduced;
var 70..85: INT____00004 :: is_defined_var :: var_is_introduced;
var 70..85: INT____00006 :: is_defined_var :: var_is_introduced;
var 1..4: Sands;
var 1..4: caddy;
var 1..4: clerk;
var 1..4: cook;
array [1..4] of var 1..4: last_name :: output_array([1..4]) = [Green, Clubb, Sands, Carter];
var 1..4: maintenance_man;
array [1..4] of var 1..4: job :: output_array([1..4]) = [cook, maintenance_man, clerk, caddy];
array [1..4] of var 70..85: score :: output_array([1..4]);
constraint all_different_int(job);
constraint all_different_int(last_name);
constraint all_different_int(score);
constraint array_bool_and([BOOL____00005, BOOL____00007], BOOL____00010) :: defines_var(BOOL____00010);
constraint array_bool_and([BOOL____00008, BOOL____00009], BOOL____00011) :: defines_var(BOOL____00011);
constraint array_bool_or([BOOL____00010, BOOL____00011], true);
constraint array_var_int_element(Carter, score, 78);
constraint array_var_int_element(Clubb, score, INT____00003);
constraint array_var_int_element(Sands, score, INT____00004) :: defines_var(INT____00004);
constraint array_var_int_element(caddy, score, INT____00006) :: defines_var(INT____00006);
constraint array_var_int_element(clerk, score, INT____00002) :: defines_var(INT____00002);
constraint int_lin_eq([-1, 1], [INT____00003, INT____00002], -10) :: defines_var(INT____00003);
constraint int_lin_eq_reif([-1, 1], [INT____00004, INT____00006], 4, BOOL____00009) :: defines_var(BOOL____00009);
constraint int_lin_eq_reif([-1, 1], [INT____00004, INT____00006], 7, BOOL____00007) :: defines_var(BOOL____00007);
constraint int_lin_eq_reif([-1, 1], [INT____00004, score[4]], 4, BOOL____00005) :: defines_var(BOOL____00005);
constraint int_lin_eq_reif([-1, 1], [INT____00004, score[4]], 7, BOOL____00008) :: defines_var(BOOL____00008);
constraint int_lt(score[2], score[1]);
constraint int_lt(score[2], score[3]);
constraint int_lt(score[2], score[4]);
constraint int_lt(score[4], 78);
constraint int_ne(2, maintenance_man);
constraint int_ne(4, Carter);
constraint int_ne(4, Sands);
constraint int_ne(4, caddy);
constraint int_ne(Clubb, 3);
constraint int_ne(caddy, Sands);
constraint int_ne(score[1], 81);
constraint int_ne(score[2], 81);
constraint int_ne(score[3], 81);
constraint int_ne(score[4], 81);
solve satisfy;