-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
K4P2GracefulGraph2.fzn
65 lines (65 loc) · 4.31 KB
/
K4P2GracefulGraph2.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
65
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);
var -16..16: INT____00001 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00003 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00005 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00007 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00009 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00011 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00013 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00015 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00017 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00019 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00021 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00023 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00025 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00027 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00029 :: is_defined_var :: var_is_introduced;
var -16..16: INT____00031 :: is_defined_var :: var_is_introduced;
array [1..16] of var 1..16: edges :: output_array([1..16]);
array [1..32] of var 1..8: graph = [1, 2, 1, 3, 1, 4, 2, 3, 2, 4, 3, 4, 5, 6, 5, 7, 5, 8, 6, 7, 6, 8, 7, 8, 1, 5, 2, 6, 3, 7, 4, 8];
array [1..8] of var 0..16: nodes :: output_array([1..8]);
constraint fzn_all_different_int(nodes);
constraint fzn_all_different_int(edges);
constraint int_abs(INT____00001, edges[1]);
constraint int_abs(INT____00003, edges[2]);
constraint int_abs(INT____00005, edges[3]);
constraint int_abs(INT____00007, edges[4]);
constraint int_abs(INT____00009, edges[5]);
constraint int_abs(INT____00011, edges[6]);
constraint int_abs(INT____00013, edges[7]);
constraint int_abs(INT____00015, edges[8]);
constraint int_abs(INT____00017, edges[9]);
constraint int_abs(INT____00019, edges[10]);
constraint int_abs(INT____00021, edges[11]);
constraint int_abs(INT____00023, edges[12]);
constraint int_abs(INT____00025, edges[13]);
constraint int_abs(INT____00027, edges[14]);
constraint int_abs(INT____00029, edges[15]);
constraint int_abs(INT____00031, edges[16]);
constraint int_plus(INT____00001, nodes[2], nodes[1]) :: defines_var(INT____00001);
constraint int_plus(INT____00003, nodes[3], nodes[1]) :: defines_var(INT____00003);
constraint int_plus(INT____00005, nodes[4], nodes[1]) :: defines_var(INT____00005);
constraint int_plus(INT____00025, nodes[5], nodes[1]) :: defines_var(INT____00025);
constraint int_plus(INT____00007, nodes[3], nodes[2]) :: defines_var(INT____00007);
constraint int_plus(INT____00009, nodes[4], nodes[2]) :: defines_var(INT____00009);
constraint int_plus(INT____00027, nodes[6], nodes[2]) :: defines_var(INT____00027);
constraint int_plus(INT____00011, nodes[4], nodes[3]) :: defines_var(INT____00011);
constraint int_plus(INT____00029, nodes[7], nodes[3]) :: defines_var(INT____00029);
constraint int_plus(INT____00031, nodes[8], nodes[4]) :: defines_var(INT____00031);
constraint int_plus(INT____00013, nodes[6], nodes[5]) :: defines_var(INT____00013);
constraint int_plus(INT____00015, nodes[7], nodes[5]) :: defines_var(INT____00015);
constraint int_plus(INT____00017, nodes[8], nodes[5]) :: defines_var(INT____00017);
constraint int_plus(INT____00019, nodes[7], nodes[6]) :: defines_var(INT____00019);
constraint int_plus(INT____00021, nodes[8], nodes[6]) :: defines_var(INT____00021);
constraint int_plus(INT____00023, nodes[8], nodes[7]) :: defines_var(INT____00023);
solve :: int_search(nodes, first_fail, indomain, complete) satisfy;