|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| package org.sat4j.minisat.constraints; |
|
8 |
| |
|
9 |
| import java.io.Serializable; |
|
10 |
| import java.math.BigInteger; |
|
11 |
| |
|
12 |
| import org.sat4j.core.Vec; |
|
13 |
| import org.sat4j.minisat.constraints.cnf.Lits; |
|
14 |
| import org.sat4j.minisat.constraints.cnf.WLClause; |
|
15 |
| import org.sat4j.minisat.core.Constr; |
|
16 |
| import org.sat4j.minisat.core.DataStructureFactory; |
|
17 |
| import org.sat4j.minisat.core.ILits; |
|
18 |
| import org.sat4j.minisat.core.Learner; |
|
19 |
| import org.sat4j.minisat.core.Propagatable; |
|
20 |
| import org.sat4j.minisat.core.UnitPropagationListener; |
|
21 |
| import org.sat4j.specs.ContradictionException; |
|
22 |
| import org.sat4j.specs.IVec; |
|
23 |
| import org.sat4j.specs.IVecInt; |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| public abstract class AbstractDataStructureFactory implements |
|
30 |
| DataStructureFactory, Serializable { |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
| |
|
37 |
131078363
| public void conflictDetectedInWatchesFor(int p, int i) {
|
|
38 |
131078363
| for (int j = i + 1; j < tmp.size(); j++) {
|
|
39 |
1138298091
| lits.watch(p, tmp.get(j));
|
|
40 |
| } |
|
41 |
| } |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| public IVec<Propagatable> getWatchesFor(int p) { |
|
49 |
| tmp.clear(); |
|
50 |
| lits.watches(p).moveTo(tmp); |
|
51 |
| return tmp; |
|
52 |
| } |
|
53 |
| |
|
54 |
| protected ILits lits = new Lits(); |
|
55 |
| |
|
56 |
| private final IVec<Propagatable> tmp = new Vec<Propagatable>(); |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
267080417
| public ILits getVocabulary() {
|
|
64 |
267080417
| return lits;
|
|
65 |
| } |
|
66 |
| |
|
67 |
| protected UnitPropagationListener solver; |
|
68 |
| |
|
69 |
| protected Learner learner; |
|
70 |
| |
|
71 |
2506
| public void setUnitPropagationListener(UnitPropagationListener s) {
|
|
72 |
2506
| solver = s;
|
|
73 |
| } |
|
74 |
| |
|
75 |
2506
| public void setLearner(Learner learner) {
|
|
76 |
2506
| this.learner = learner;
|
|
77 |
| } |
|
78 |
| |
|
79 |
2490
| public void reset() {
|
|
80 |
| } |
|
81 |
| |
|
82 |
3685182
| public void learnConstraint(Constr constr) {
|
|
83 |
3685182
| learner.learn(constr);
|
|
84 |
| } |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
0
| public Constr createCardinalityConstraint(IVecInt literals, int degree)
|
|
93 |
| throws ContradictionException { |
|
94 |
0
| throw new UnsupportedOperationException();
|
|
95 |
| } |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
0
| public Constr createPseudoBooleanConstraint(IVecInt literals,
|
|
104 |
| IVec<BigInteger> coefs, boolean moreThan, BigInteger degree) |
|
105 |
| throws ContradictionException { |
|
106 |
0
| throw new UnsupportedOperationException();
|
|
107 |
| } |
|
108 |
| |
|
109 |
0
| public Constr createUnregisteredPseudoBooleanConstraint(IVecInt literals,
|
|
110 |
| IVec<BigInteger> coefs, BigInteger degree) { |
|
111 |
0
| throw new UnsupportedOperationException();
|
|
112 |
| } |
|
113 |
| |
|
114 |
| |
|
115 |
| } |