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