|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| package org.sat4j.minisat.constraints; |
|
8 |
| |
|
9 |
| import org.sat4j.minisat.constraints.cnf.Lits2; |
|
10 |
| import org.sat4j.minisat.constraints.cnf.WLClause; |
|
11 |
| import org.sat4j.minisat.core.Constr; |
|
12 |
| import org.sat4j.minisat.core.ILits; |
|
13 |
| import org.sat4j.minisat.core.ILits2; |
|
14 |
| import org.sat4j.specs.ContradictionException; |
|
15 |
| import org.sat4j.specs.IVecInt; |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| public class MixedDataStructureWithBinary extends MixedDataStructureDaniel { |
|
22 |
| |
|
23 |
| private static final long serialVersionUID = 1L; |
|
24 |
| |
|
25 |
| private final ILits2 mlits = new Lits2(); |
|
26 |
| |
|
27 |
| { |
|
28 |
207
| lits = mlits;
|
|
29 |
| } |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| |
|
36 |
17758984
| @Override
|
|
37 |
| public ILits getVocabulary() { |
|
38 |
17758984
| return lits;
|
|
39 |
| } |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
| |
|
45 |
| |
|
46 |
500607
| @Override
|
|
47 |
| public Constr createClause(IVecInt literals) throws ContradictionException { |
|
48 |
500607
| IVecInt v = WLClause.sanityCheck(literals, lits, solver);
|
|
49 |
500607
| if (v == null)
|
|
50 |
26
| return null;
|
|
51 |
500581
| if (v.size() == 2) {
|
|
52 |
391125
| mlits.binaryClauses(v.get(0), v.get(1));
|
|
53 |
391125
| return null;
|
|
54 |
| } |
|
55 |
109456
| return WLClause.brandNewClause(solver, lits, v);
|
|
56 |
| } |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
3449437
| @Override
|
|
64 |
| public void learnConstraint(Constr constr) { |
|
65 |
3449437
| if (constr.size() == 2) {
|
|
66 |
487
| mlits.binaryClauses(constr.get(0), constr.get(1));
|
|
67 |
| |
|
68 |
| } else { |
|
69 |
3448950
| super.learnConstraint(constr);
|
|
70 |
| } |
|
71 |
| } |
|
72 |
| } |