基于一个实际的cnf例子讲解传播。
cnf文件:
数据文件:10.44.1667358355.cnf |
1 p cnf 10 44 2 10 -1 5 0 3 -1 -4 -3 0 4 -5 -4 6 0 5 -2 -1 4 0 6 10 -8 -7 0 7 9 2 -6 0 8 -1 -2 -6 0 9 6 5 -10 0 10 8 -9 -5 0 11 -8 2 -3 0 12 -4 1 -5 0 13 -7 5 3 0 14 10 3 -5 0 15 8 9 -6 0 16 4 -6 9 0 17 10 -8 4 0 18 -1 10 -8 0 19 -1 8 -10 0 20 -7 6 -1 0 21 -6 -10 9 0 22 9 -7 -3 0 23 -4 -3 -6 0 24 -6 -7 2 0 25 -1 -6 -9 0 26 -6 -3 -4 0 27 -8 -2 6 0 28 -2 -8 4 0 29 -3 -8 10 0 30 3 -2 6 0 31 -10 7 -2 0 32 -8 10 5 0 33 7 3 6 0 34 7 4 5 0 35 9 -3 -7 0 36 2 8 -7 0 37 5 -9 3 0 38 2 -1 -8 0 39 9 6 -8 0 40 5 -3 -8 0 41 2 1 -10 0 42 -10 9 2 0 43 -4 9 -3 0 44 3 1 -6 0 45 -5 -7 -6 0 46 c 1 a_1 47 c 2 a_2 48 c 3 a_3 49 c 4 a_4 50 c 5 a_5 51 c 6 a_6 52 c 7 a_7 53 c 8 a_8 54 c 9 a_9 55 c 10 a_10 |
该文件求解时没有发生冲突,有两处蕴含推导。具体求解输出结果如下:
以上分析明白后,看下面一个求解例子的输出片段:
-----------------------On 166 starts period----At the propagetion Num : 19---------------------decisions: 64360; decision var: 56
the size of trail is 48. : 40 -100 116 76 87 -63 104 -51 98 -103 23 -17 25 -15 -114 41 50 -120 -11 -69 90 54 81 19 -9 -89 48 -31 80 60 -43 -109 -95 -75 56 28 -14 70 -107 -115 7 -77 -3 108 -37 27 -88 -79
the size of trail_lim is 9 : 0 13 14 15 16 19 22 28 29
the conflict index of trail is : 44
the conflict liter is:-37
the tow clauses get confliction each other-----
-37 3 11 69 43 -60 15 -81 17 -116 103 95 63
79 37 100 9 109 14
the uip graph:
Graph (48, 179)
8: 4 21 23 30 32 42
29: 30 32 43 44
37: 9 19 22 30 32
6: 0 12 17 18 20 21 23 26 30 32 43
10: 4 21 23 30
17: 1 2 4 5 6 7 13 14 15 16 18 21 23 30 32
44: 1 2 5 9 11 13 18 19 22 24 29 30 31 32 36 42 47
16: 17 18 20 23 30
23: 1 2 5 6 7 8 9 10 11 13 15 16 17 18 19 20 21 22 24 25
9: 4 21 23 30 32 35 36 37 43 44
31: 30 44
33: 32
24: 23 32 44
42: 8 35 41 43 44
22: 23 30 32 35 36 37 43 44
21: 1 2 5 6 7 8 9 10 11 13 14 15 17 18 19 20 23 26 32
15: 17 20 21 23 30
19: 20 21 23 30 32 35 36 37 43 44
32: 1 2 5 6 8 9 11 13 17 18 19 21 22 24 25 29 30 33 34 35 36 37 43 44
26: 6 21 25 27
12: 6 38
11: 4 21 23 30 32 43 44
1: 0 17 18 20 21 23 30 32 44
40: 38
2: 0 17 18 20 21 23 30 32 43 44
41: 38 42
28: 30
36: 9 19 22 30 32 44
18: 1 2 4 5 6 7 13 16 17 21 23 30 32 43 44
20: 1 2 4 5 6 7 13 14 15 16 19 21 23 30
0: 1 2 3 4 5 6 7
5: 0 17 18 20 21 23 30 32 43 44
27: 26
46: 43
43: 2 5 6 9 11 13 18 19 22 29 30 32 42 45 46 47
25: 23 26 32
34: 32 38
35: 9 19 22 30 32 42
47: 43 44
38: 12 30 34 39 40 41
7: 0 17 18 20 21 23 30
4: 0 8 9 10 11 17 18 20
13: 17 18 20 21 23 30 32 43 44
39: 38
45: 43
30: 1 2 5 6 7 8 9 10 11 13 14 15 16 17 18 19 20 22 28 29 31 32 35 36 37 38 43 44
3: 0
14: 17 20 21 30
c ===============================================================================
c restarts : {166}
c conflicts : {54265 } (6614 /sec)
c decisions : {70808 } (0.00 % random) (8630 /sec)
c propagations : {637034 } (77640 /sec)
c conflict literals : {918810 } (21.95 % deleted)
c backtracks : {54264 } (NCB 100% , CB 0%)
c Memory used : 1.00 MB
c CPU time : {8.205} s
s {UNSATISFIABLE}
基于这个例子我们讲一下trail和trail_lim的理解
the size of trail is 48. :
40 -100 116 76 87 -63 104 -51 98 -103 23 -17 25 -15 -114 41 50 -120 -11 -69 90 54 81 19 -9 -89 48 -31 80 60 -43 -109 -95 -75 56 28 -14 70 -107 -115 7 -77 -3 108 -37 27 -88 -79
the size of trail_lim is 9 :
0 13 14 15 16 19 22 28 29
trail_lim中每个元素表示到i层前已经传播是文字数,依据trail_lim提供的信息我们用颜色标注了各层的文字
层数 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
trail_lim | 0 | 13 | 14 | 15 | 16 | 19 | 22 | 28 | 29 |
元素个数 | 13 | 1 | 1 | 1 | 3 | 3 | 6 | 1 | (从29位置开始)长度不能由trail_lim给出,可以由trail查询得到 |
文字序列 | 40 -100 116 76 87 -63 104 -51 98 -103 23 -17 25 | -15 | -114 | 41 | 50 -120 -11 | -69 90 54 | 81 19 -9 -89 48 -31 | 80 | 60 -43 -109 -95 -75 56 28 -14 70 -107 -115 7 -77 -3 108 -37 27 -88 -79 |
首文字在 trail中 的位置 号从0 开始 |
0 | 13 | 14 | 15 | 16 | 19 | 22 | 28 | 29 |
当i>0,trail_lim[i]表明i层之前(0至i-1层)共有的元素个数,如trail_lim[6]=22,表明第6层之前共有22个元素(序号0,1,...,21)
trail_lim[i]的值为当前层的首元素在trail中的位置。例如trail_lim[8]=29,表明第8层首元素在trail中的位置序号是29.