|
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 |
| package org.sat4j.minisat.core; |
|
29 |
| |
|
30 |
| import java.io.PrintWriter; |
|
31 |
| import java.io.Serializable; |
|
32 |
| import java.lang.reflect.Field; |
|
33 |
| import java.util.HashMap; |
|
34 |
| import java.util.Map; |
|
35 |
| |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
| public class SolverStats implements Serializable { |
|
42 |
| private static final long serialVersionUID = 1L; |
|
43 |
| |
|
44 |
| public int starts; |
|
45 |
| |
|
46 |
| public long decisions; |
|
47 |
| |
|
48 |
| public long propagations; |
|
49 |
| |
|
50 |
| public long inspects; |
|
51 |
| |
|
52 |
| public long conflicts; |
|
53 |
| |
|
54 |
| public long learnedliterals; |
|
55 |
| |
|
56 |
| public long learnedbinaryclauses; |
|
57 |
| |
|
58 |
| public long learnedternaryclauses; |
|
59 |
| |
|
60 |
| public long learnedclauses; |
|
61 |
| |
|
62 |
| public long rootSimplifications; |
|
63 |
| |
|
64 |
| public long reducedliterals; |
|
65 |
| |
|
66 |
| public long changedreason; |
|
67 |
| |
|
68 |
| public int reduceddb; |
|
69 |
| |
|
70 |
2490
| public void reset() {
|
|
71 |
2490
| starts = 0;
|
|
72 |
2490
| decisions = 0;
|
|
73 |
2490
| propagations = 0;
|
|
74 |
2490
| inspects = 0;
|
|
75 |
2490
| conflicts = 0;
|
|
76 |
2490
| learnedliterals = 0;
|
|
77 |
2490
| learnedclauses = 0;
|
|
78 |
2490
| learnedbinaryclauses = 0;
|
|
79 |
2490
| learnedternaryclauses = 0;
|
|
80 |
2490
| rootSimplifications = 0;
|
|
81 |
2490
| reducedliterals=0;
|
|
82 |
2490
| changedreason=0;
|
|
83 |
2490
| reduceddb=0;
|
|
84 |
| } |
|
85 |
| |
|
86 |
0
| public void printStat(PrintWriter out, String prefix) {
|
|
87 |
0
| out.println(prefix + "starts\t\t: " + starts);
|
|
88 |
0
| out.println(prefix + "conflicts\t\t: " + conflicts);
|
|
89 |
0
| out.println(prefix + "decisions\t\t: " + decisions);
|
|
90 |
0
| out.println(prefix + "propagations\t\t: " + propagations);
|
|
91 |
0
| out.println(prefix + "inspects\t\t: " + inspects);
|
|
92 |
0
| out.println(prefix + "learnt literals\t: " + learnedliterals);
|
|
93 |
0
| out.println(prefix + "learnt binary clauses\t: "
|
|
94 |
| + learnedbinaryclauses); |
|
95 |
0
| out.println(prefix + "learnt ternary clauses\t: "
|
|
96 |
| + learnedternaryclauses); |
|
97 |
0
| out.println(prefix + "learnt clauses\t: " + learnedclauses);
|
|
98 |
0
| out.println(prefix + "root simplifications\t: "
|
|
99 |
| + rootSimplifications); |
|
100 |
0
| out.println(prefix + "removed literals (reason simplification)\t: "
|
|
101 |
| + reducedliterals); |
|
102 |
0
| out.println(prefix + "reason swapping (by a shorter reason)\t: "
|
|
103 |
| + changedreason); |
|
104 |
0
| out.println(prefix + "Calls to reduceDB\t: "
|
|
105 |
| + reduceddb); |
|
106 |
| } |
|
107 |
| |
|
108 |
0
| public Map<String,Number> toMap() {
|
|
109 |
0
| Map<String,Number> map = new HashMap<String,Number>();
|
|
110 |
0
| for (Field f : this.getClass().getDeclaredFields()) {
|
|
111 |
0
| try {
|
|
112 |
0
| map.put(f.getName(),(Number)f.get(this));
|
|
113 |
| } catch (IllegalArgumentException e) { |
|
114 |
| |
|
115 |
0
| e.printStackTrace();
|
|
116 |
| } catch (IllegalAccessException e) { |
|
117 |
| |
|
118 |
0
| e.printStackTrace();
|
|
119 |
| } |
|
120 |
| } |
|
121 |
0
| return map;
|
|
122 |
| } |
|
123 |
| } |