forked from google/or-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adjacency_matrix_from_degrees.fzn
41 lines (41 loc) · 2.43 KB
/
adjacency_matrix_from_degrees.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
array [1..4] of int: degrees = [1, 2, 2, 1];
var bool: BOOL____00001 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00002 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00004 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00006 :: 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____00011 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00013 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00014 :: is_defined_var :: var_is_introduced;
var bool: BOOL____00016 :: is_defined_var :: var_is_introduced;
array [1..16] of var 0..1: x :: output_array([1..4, 1..4]);
constraint int_eq(x[1], 0);
constraint int_eq(x[6], 0);
constraint int_eq(x[11], 0);
constraint int_eq(x[16], 0);
constraint int_eq_reif(x[1], 1, BOOL____00001) :: defines_var(BOOL____00001);
constraint int_eq_reif(x[2], 1, BOOL____00002) :: defines_var(BOOL____00002);
constraint int_eq_reif(x[3], 1, BOOL____00004) :: defines_var(BOOL____00004);
constraint int_eq_reif(x[4], 1, BOOL____00006) :: defines_var(BOOL____00006);
constraint int_eq_reif(x[5], 1, BOOL____00002);
constraint int_eq_reif(x[6], 1, BOOL____00008) :: defines_var(BOOL____00008);
constraint int_eq_reif(x[7], 1, BOOL____00009) :: defines_var(BOOL____00009);
constraint int_eq_reif(x[8], 1, BOOL____00011) :: defines_var(BOOL____00011);
constraint int_eq_reif(x[9], 1, BOOL____00004);
constraint int_eq_reif(x[10], 1, BOOL____00009);
constraint int_eq_reif(x[11], 1, BOOL____00013) :: defines_var(BOOL____00013);
constraint int_eq_reif(x[12], 1, BOOL____00014) :: defines_var(BOOL____00014);
constraint int_eq_reif(x[13], 1, BOOL____00006);
constraint int_eq_reif(x[14], 1, BOOL____00011);
constraint int_eq_reif(x[15], 1, BOOL____00014);
constraint int_eq_reif(x[16], 1, BOOL____00016) :: defines_var(BOOL____00016);
constraint int_lin_eq([1, 1, 1, 1], [x[1], x[2], x[3], x[4]], 1);
constraint int_lin_eq([1, 1, 1, 1], [x[1], x[5], x[9], x[13]], 1);
constraint int_lin_eq([1, 1, 1, 1], [x[2], x[6], x[10], x[14]], 2);
constraint int_lin_eq([1, 1, 1, 1], [x[3], x[7], x[11], x[15]], 2);
constraint int_lin_eq([1, 1, 1, 1], [x[4], x[8], x[12], x[16]], 1);
constraint int_lin_eq([1, 1, 1, 1], [x[5], x[6], x[7], x[8]], 2);
constraint int_lin_eq([1, 1, 1, 1], [x[9], x[10], x[11], x[12]], 2);
constraint int_lin_eq([1, 1, 1, 1], [x[13], x[14], x[15], x[16]], 1);
solve satisfy;