Skip to content

Commit b6e6975

Browse files
committed
Preparations for formula and solver serializiation
1 parent 10ab16e commit b6e6975

10 files changed

+162
-29
lines changed

src/main/java/org/logicng/collections/LNGBooleanVector.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ public LNGBooleanVector(final boolean... elems) {
8888
this.size = elems.length;
8989
}
9090

91-
LNGBooleanVector(final boolean[] elements, final int size) {
91+
/**
92+
* Creates a vector with the given elements and capacity.
93+
* @param elements the elements
94+
* @param size the capacity of the vector
95+
*/
96+
public LNGBooleanVector(final boolean[] elements, final int size) {
9297
this.elements = elements;
9398
this.size = size;
9499
}

src/main/java/org/logicng/collections/LNGIntVector.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ public LNGIntVector(final int... elems) {
8888
this.size = elems.length;
8989
}
9090

91-
LNGIntVector(final int[] elements, final int size) {
91+
/**
92+
* Creates a vector with the given elements and capacity.
93+
* @param elements the elements
94+
* @param size the capacity of the vector
95+
*/
96+
public LNGIntVector(final int[] elements, final int size) {
9297
this.elements = elements;
9398
this.size = size;
9499
}

src/main/java/org/logicng/collections/LNGLongVector.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ public LNGLongVector(final long... elems) {
8888
this.size = elems.length;
8989
}
9090

91-
LNGLongVector(final long[] elements, final int size) {
91+
/**
92+
* Creates a vector with the given elements and capacity.
93+
* @param elements the elements
94+
* @param size the capacity of the vector
95+
*/
96+
public LNGLongVector(final long[] elements, final int size) {
9297
this.elements = elements;
9398
this.size = size;
9499
}

src/main/java/org/logicng/solvers/datastructures/LNGBoundedIntQueue.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public LNGBoundedIntQueue() {
104104
this.queueSize = 0;
105105
}
106106

107-
LNGBoundedIntQueue(final LNGIntVector elems, final int first, final int last, final long sumOfQueue,
108-
final int maxSize, final int queueSize) {
107+
public LNGBoundedIntQueue(final LNGIntVector elems, final int first, final int last, final long sumOfQueue,
108+
final int maxSize, final int queueSize) {
109109
this.elems = elems;
110110
this.first = first;
111111
this.last = last;
@@ -164,27 +164,27 @@ private void growTo(final int size) {
164164
this.last = 0;
165165
}
166166

167-
LNGIntVector getElems() {
167+
public LNGIntVector getElems() {
168168
return this.elems;
169169
}
170170

171-
int getFirst() {
171+
public int getFirst() {
172172
return this.first;
173173
}
174174

175-
int getLast() {
175+
public int getLast() {
176176
return this.last;
177177
}
178178

179-
long getSumOfQueue() {
179+
public long getSumOfQueue() {
180180
return this.sumOfQueue;
181181
}
182182

183-
int getMaxSize() {
183+
public int getMaxSize() {
184184
return this.maxSize;
185185
}
186186

187-
int getQueueSize() {
187+
public int getQueueSize() {
188188
return this.queueSize;
189189
}
190190

src/main/java/org/logicng/solvers/datastructures/LNGBoundedLongQueue.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public LNGBoundedLongQueue() {
104104
this.queueSize = 0;
105105
}
106106

107-
LNGBoundedLongQueue(final LNGLongVector elems, final int first, final int last, final long sumOfQueue,
108-
final int maxSize, final int queueSize) {
107+
public LNGBoundedLongQueue(final LNGLongVector elems, final int first, final int last, final long sumOfQueue,
108+
final int maxSize, final int queueSize) {
109109
this.elems = elems;
110110
this.first = first;
111111
this.last = last;
@@ -182,27 +182,27 @@ public void fastClear() {
182182
this.sumOfQueue = 0;
183183
}
184184

185-
LNGLongVector getElems() {
185+
public LNGLongVector getElems() {
186186
return this.elems;
187187
}
188188

189-
int getFirst() {
189+
public int getFirst() {
190190
return this.first;
191191
}
192192

193-
int getLast() {
193+
public int getLast() {
194194
return this.last;
195195
}
196196

197-
long getSumOfQueue() {
197+
public long getSumOfQueue() {
198198
return this.sumOfQueue;
199199
}
200200

201-
int getMaxSize() {
201+
public int getMaxSize() {
202202
return this.maxSize;
203203
}
204204

205-
int getQueueSize() {
205+
public int getQueueSize() {
206206
return this.queueSize;
207207
}
208208

src/main/java/org/logicng/solvers/datastructures/LNGHeap.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ public LNGHeap(final MiniSatStyleSolver solver) {
6969
this.indices = new LNGIntVector(1000);
7070
}
7171

72-
LNGHeap(final MiniSatStyleSolver s, final LNGIntVector heap, final LNGIntVector indices) {
73-
this.s = s;
72+
/**
73+
* Constructs a new heap for a given solver and content.
74+
* @param solver the solver
75+
* @param heap the heap content
76+
* @param indices the indices content
77+
*/
78+
public LNGHeap(final MiniSatStyleSolver solver, final LNGIntVector heap, final LNGIntVector indices) {
79+
this.s = solver;
7480
this.heap = heap;
7581
this.indices = indices;
7682
}
@@ -258,11 +264,11 @@ private void percolateDown(final int pos) {
258264
this.indices.set(y, p);
259265
}
260266

261-
LNGIntVector getHeap() {
267+
public LNGIntVector getHeap() {
262268
return this.heap;
263269
}
264270

265-
LNGIntVector getIndices() {
271+
public LNGIntVector getIndices() {
266272
return this.indices;
267273
}
268274

src/main/java/org/logicng/solvers/datastructures/MSClause.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ public MSClause(final LNGIntVector ps, final boolean learnt, final boolean isAtM
123123
this.atMostWatchers = -1;
124124
}
125125

126-
MSClause(final LNGIntVector data, final boolean learnt, final boolean isAtMost, final double activity,
127-
final int szWithoutSelectors, final boolean seen, final long lbd, final boolean canBeDel,
128-
final boolean oneWatched, final int atMostWatchers) {
126+
public MSClause(final LNGIntVector data, final boolean learnt, final boolean isAtMost, final double activity,
127+
final int szWithoutSelectors, final boolean seen, final long lbd, final boolean canBeDel,
128+
final boolean oneWatched, final int atMostWatchers) {
129129
this.data = data;
130130
this.learnt = learnt;
131131
this.isAtMost = isAtMost;
@@ -316,7 +316,7 @@ public int cardinality() {
316316
return this.data.size() - this.atMostWatchers + 1;
317317
}
318318

319-
LNGIntVector getData() {
319+
public LNGIntVector getData() {
320320
return this.data;
321321
}
322322

src/main/java/org/logicng/solvers/datastructures/MSVariable.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public MSVariable(final boolean polarity) {
7474
this.decision = false;
7575
}
7676

77-
MSVariable(final Tristate assignment, final int level, final MSClause reason, final double activity,
78-
final boolean polarity, final boolean decision) {
77+
public MSVariable(final Tristate assignment, final int level, final MSClause reason, final double activity,
78+
final boolean polarity, final boolean decision) {
7979
this.assignment = assignment;
8080
this.level = level;
8181
this.reason = reason;

src/main/java/org/logicng/solvers/sat/GlucoseConfig.java

+52
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,58 @@ public static Builder builder() {
8181
return new Builder();
8282
}
8383

84+
public int getLbLBDMinimizingClause() {
85+
return this.lbLBDMinimizingClause;
86+
}
87+
88+
public int getLbLBDFrozenClause() {
89+
return this.lbLBDFrozenClause;
90+
}
91+
92+
public int getLbSizeMinimizingClause() {
93+
return this.lbSizeMinimizingClause;
94+
}
95+
96+
public int getFirstReduceDB() {
97+
return this.firstReduceDB;
98+
}
99+
100+
public int getSpecialIncReduceDB() {
101+
return this.specialIncReduceDB;
102+
}
103+
104+
public int getIncReduceDB() {
105+
return this.incReduceDB;
106+
}
107+
108+
public double getFactorK() {
109+
return this.factorK;
110+
}
111+
112+
public double getFactorR() {
113+
return this.factorR;
114+
}
115+
116+
public int getSizeLBDQueue() {
117+
return this.sizeLBDQueue;
118+
}
119+
120+
public int getSizeTrailQueue() {
121+
return this.sizeTrailQueue;
122+
}
123+
124+
public boolean isReduceOnSize() {
125+
return this.reduceOnSize;
126+
}
127+
128+
public int getReduceOnSizeSize() {
129+
return this.reduceOnSizeSize;
130+
}
131+
132+
public double getMaxVarDecay() {
133+
return this.maxVarDecay;
134+
}
135+
84136
@Override
85137
public String toString() {
86138
final StringBuilder sb = new StringBuilder("GlucoseConfig{").append(System.lineSeparator());

src/main/java/org/logicng/solvers/sat/MiniSatConfig.java

+60
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,66 @@ public boolean isAuxiliaryVariablesInModels() {
167167
return this.auxiliaryVariablesInModels;
168168
}
169169

170+
public double getVarDecay() {
171+
return this.varDecay;
172+
}
173+
174+
public double getVarInc() {
175+
return this.varInc;
176+
}
177+
178+
public ClauseMinimization getClauseMin() {
179+
return this.clauseMin;
180+
}
181+
182+
public int getRestartFirst() {
183+
return this.restartFirst;
184+
}
185+
186+
public double getRestartInc() {
187+
return this.restartInc;
188+
}
189+
190+
public double getClauseDecay() {
191+
return this.clauseDecay;
192+
}
193+
194+
public boolean isRemoveSatisfied() {
195+
return this.removeSatisfied;
196+
}
197+
198+
public double getLearntsizeFactor() {
199+
return this.learntsizeFactor;
200+
}
201+
202+
public double getLearntsizeInc() {
203+
return this.learntsizeInc;
204+
}
205+
206+
public boolean isIncremental() {
207+
return this.incremental;
208+
}
209+
210+
public boolean isInitialPhase() {
211+
return this.initialPhase;
212+
}
213+
214+
public boolean isProofGeneration() {
215+
return this.proofGeneration;
216+
}
217+
218+
public boolean isBbInitialUBCheckForRotatableLiterals() {
219+
return this.bbInitialUBCheckForRotatableLiterals;
220+
}
221+
222+
public boolean isBbCheckForComplementModelLiterals() {
223+
return this.bbCheckForComplementModelLiterals;
224+
}
225+
226+
public boolean isBbCheckForRotatableLiterals() {
227+
return this.bbCheckForRotatableLiterals;
228+
}
229+
170230
@Override
171231
public String toString() {
172232
final StringBuilder sb = new StringBuilder("MiniSatConfig{").append(System.lineSeparator());

0 commit comments

Comments
 (0)