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.tools;
31
32 import java.io.PrintStream;
33 import java.io.PrintWriter;
34 import java.util.Map;
35
36 import org.sat4j.specs.ContradictionException;
37 import org.sat4j.specs.IConstr;
38 import org.sat4j.specs.ISolver;
39 import org.sat4j.specs.ISolverService;
40 import org.sat4j.specs.IVec;
41 import org.sat4j.specs.IVecInt;
42 import org.sat4j.specs.SearchListener;
43 import org.sat4j.specs.TimeoutException;
44
45
46
47
48
49
50
51
52 public abstract class SolverDecorator<T extends ISolver> implements ISolver {
53
54
55
56
57 private static final long serialVersionUID = 1L;
58
59 public boolean isDBSimplificationAllowed() {
60 return this.solver.isDBSimplificationAllowed();
61 }
62
63 public void setDBSimplificationAllowed(boolean status) {
64 this.solver.setDBSimplificationAllowed(status);
65 }
66
67
68
69
70
71
72 public void setTimeoutOnConflicts(int count) {
73 this.solver.setTimeoutOnConflicts(count);
74 }
75
76
77
78
79
80
81
82 public void printInfos(PrintWriter out, String prefix) {
83 this.solver.printInfos(out, prefix);
84 }
85
86
87
88
89
90
91 public boolean isSatisfiable(boolean global) throws TimeoutException {
92 return this.solver.isSatisfiable(global);
93 }
94
95
96
97
98
99
100
101 public boolean isSatisfiable(IVecInt assumps, boolean global)
102 throws TimeoutException {
103 return this.solver.isSatisfiable(assumps, global);
104 }
105
106
107
108
109
110
111 public void clearLearntClauses() {
112 this.solver.clearLearntClauses();
113 }
114
115
116
117
118
119
120 public int[] findModel() throws TimeoutException {
121 return this.solver.findModel();
122 }
123
124
125
126
127
128
129 public int[] findModel(IVecInt assumps) throws TimeoutException {
130 return this.solver.findModel(assumps);
131 }
132
133
134
135
136
137
138 public boolean model(int var) {
139 return this.solver.model(var);
140 }
141
142 public void setExpectedNumberOfClauses(int nb) {
143 this.solver.setExpectedNumberOfClauses(nb);
144 }
145
146
147
148
149
150
151 public int getTimeout() {
152 return this.solver.getTimeout();
153 }
154
155
156
157
158 public long getTimeoutMs() {
159 return this.solver.getTimeoutMs();
160 }
161
162
163
164
165
166
167 public String toString(String prefix) {
168 return this.solver.toString(prefix);
169 }
170
171 @Override
172 public String toString() {
173 return toString("");
174 }
175
176
177
178
179
180
181
182 @Deprecated
183 public void printStat(PrintStream out, String prefix) {
184 this.solver.printStat(out, prefix);
185 }
186
187 public void printStat(PrintWriter out, String prefix) {
188 this.solver.printStat(out, prefix);
189 }
190
191 private T solver;
192
193
194
195
196 public SolverDecorator(T solver) {
197 this.solver = solver;
198 }
199
200 @Deprecated
201 public int newVar() {
202 return this.solver.newVar();
203 }
204
205
206
207
208
209
210 public int newVar(int howmany) {
211 return this.solver.newVar(howmany);
212 }
213
214
215
216
217
218
219 public IConstr addClause(IVecInt literals) throws ContradictionException {
220 return this.solver.addClause(literals);
221 }
222
223 public void addAllClauses(IVec<IVecInt> clauses)
224 throws ContradictionException {
225 this.solver.addAllClauses(clauses);
226 }
227
228
229
230
231 public IConstr addBlockingClause(IVecInt literals)
232 throws ContradictionException {
233 return this.solver.addBlockingClause(literals);
234 }
235
236
237
238
239
240
241 public IConstr addAtMost(IVecInt literals, int degree)
242 throws ContradictionException {
243 return this.solver.addAtMost(literals, degree);
244 }
245
246
247
248
249
250
251 public IConstr addAtLeast(IVecInt literals, int degree)
252 throws ContradictionException {
253 return this.solver.addAtLeast(literals, degree);
254 }
255
256
257
258
259
260
261 public int[] model() {
262 return this.solver.model();
263 }
264
265
266
267
268
269
270 public boolean isSatisfiable() throws TimeoutException {
271 return this.solver.isSatisfiable();
272 }
273
274
275
276
277
278
279 public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
280 return this.solver.isSatisfiable(assumps);
281 }
282
283
284
285
286
287
288 public void setTimeout(int t) {
289 this.solver.setTimeout(t);
290 }
291
292
293
294
295
296
297 public void setTimeoutMs(long t) {
298 this.solver.setTimeoutMs(t);
299 }
300
301
302
303
304
305
306 public void expireTimeout() {
307 this.solver.expireTimeout();
308 }
309
310
311
312
313
314
315 public int nConstraints() {
316 return this.solver.nConstraints();
317 }
318
319
320
321
322
323
324 public int nVars() {
325 return this.solver.nVars();
326 }
327
328
329
330
331
332
333 public void reset() {
334 this.solver.reset();
335 }
336
337 public T decorated() {
338 return this.solver;
339 }
340
341
342
343
344
345
346
347 public T clearDecorated() {
348 T decorated = this.solver;
349 this.solver = null;
350 return decorated;
351 }
352
353
354
355
356
357
358 public boolean removeConstr(IConstr c) {
359 return this.solver.removeConstr(c);
360 }
361
362
363
364
365
366
367 public Map<String, Number> getStat() {
368 return this.solver.getStat();
369 }
370
371
372
373
374 public <S extends ISolverService> void setSearchListener(
375 SearchListener<S> sl) {
376 this.solver.setSearchListener(sl);
377 }
378
379
380
381
382 public int nextFreeVarId(boolean reserve) {
383 return this.solver.nextFreeVarId(reserve);
384 }
385
386
387
388
389 public boolean removeSubsumedConstr(IConstr c) {
390 return this.solver.removeSubsumedConstr(c);
391 }
392
393
394
395
396 public <S extends ISolverService> SearchListener<S> getSearchListener() {
397 return this.solver.getSearchListener();
398 }
399
400
401
402
403 public boolean isVerbose() {
404 return this.solver.isVerbose();
405 }
406
407
408
409
410 public void setVerbose(boolean value) {
411 this.solver.setVerbose(value);
412 }
413
414
415
416
417 public void setLogPrefix(String prefix) {
418 this.solver.setLogPrefix(prefix);
419 }
420
421
422
423
424 public String getLogPrefix() {
425 return this.solver.getLogPrefix();
426 }
427
428
429
430
431 public IVecInt unsatExplanation() {
432 return this.solver.unsatExplanation();
433 }
434
435
436
437
438 public int[] primeImplicant() {
439 return this.solver.primeImplicant();
440 }
441
442
443
444
445 public IConstr addExactly(IVecInt literals, int n)
446 throws ContradictionException {
447 return this.solver.addExactly(literals, n);
448 }
449
450
451
452
453 public int[] modelWithInternalVariables() {
454 return this.solver.modelWithInternalVariables();
455 }
456
457
458
459
460 public int realNumberOfVariables() {
461 return this.solver.realNumberOfVariables();
462 }
463
464
465
466
467 public void registerLiteral(int p) {
468 this.solver.registerLiteral(p);
469 }
470
471
472
473
474 public boolean isSolverKeptHot() {
475 return this.solver.isSolverKeptHot();
476 }
477
478
479
480
481 public void setKeepSolverHot(boolean value) {
482 this.solver.setKeepSolverHot(value);
483 }
484
485
486
487
488 public boolean primeImplicant(int p) {
489 return this.solver.primeImplicant(p);
490 }
491
492 }