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