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 void reset() {
80 this.starts = 0;
81 this.decisions = 0;
82 this.propagations = 0;
83 this.inspects = 0;
84 this.shortcuts = 0;
85 this.conflicts = 0;
86 this.learnedliterals = 0;
87 this.learnedclauses = 0;
88 this.ignoredclauses = 0;
89 this.learnedbinaryclauses = 0;
90 this.learnedternaryclauses = 0;
91 this.rootSimplifications = 0;
92 this.reducedliterals = 0;
93 this.changedreason = 0;
94 this.reduceddb = 0;
95 this.updateLBD = 0;
96 }
97
98 public void printStat(PrintWriter out, String prefix) {
99 out.println(prefix + "starts\t\t: " + this.starts);
100 out.println(prefix + "conflicts\t\t: " + this.conflicts);
101 out.println(prefix + "decisions\t\t: " + this.decisions);
102 out.println(prefix + "propagations\t\t: " + this.propagations);
103 out.println(prefix + "inspects\t\t: " + this.inspects);
104 out.println(prefix + "shortcuts\t\t: " + this.shortcuts);
105 out.println(prefix + "learnt literals\t: " + this.learnedliterals);
106 out.println(prefix + "learnt binary clauses\t: "
107 + this.learnedbinaryclauses);
108 out.println(prefix + "learnt ternary clauses\t: "
109 + this.learnedternaryclauses);
110 out.println(prefix + "learnt constraints\t: " + this.learnedclauses);
111 out.println(prefix + "ignored constraints\t: " + this.ignoredclauses);
112 out.println(prefix + "root simplifications\t: "
113 + this.rootSimplifications);
114 out.println(prefix + "removed literals (reason simplification)\t: "
115 + this.reducedliterals);
116 out.println(prefix + "reason swapping (by a shorter reason)\t: "
117 + this.changedreason);
118 out.println(prefix + "Calls to reduceDB\t: " + this.reduceddb);
119 out.println(prefix + "Number of update (reduction) of LBD\t: "
120 + this.updateLBD);
121 }
122
123 public Map<String, Number> toMap() {
124 Map<String, Number> map = new HashMap<String, Number>();
125 for (Field f : this.getClass().getFields()) {
126 try {
127 map.put(f.getName(), (Number) f.get(this));
128 } catch (IllegalArgumentException e) {
129
130 } catch (IllegalAccessException e) {
131
132 }
133 }
134 return map;
135 }
136 }