1 |
| package org.sat4j.minisat.constraints.pb; |
2 |
| |
3 |
| import java.math.BigInteger; |
4 |
| |
5 |
| import org.sat4j.minisat.constraints.cnf.MixableCBClause; |
6 |
| import org.sat4j.minisat.core.ILits; |
7 |
| import org.sat4j.minisat.core.UnitPropagationListener; |
8 |
| import org.sat4j.specs.IVecInt; |
9 |
| |
10 |
| public class MixableCBClausePB extends MixableCBClause implements PBConstr{ |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| private static final long serialVersionUID = 1L; |
16 |
| |
17 |
0
| public MixableCBClausePB(IVecInt ps, ILits voc, boolean learnt) {
|
18 |
0
| super(ps, voc, learnt);
|
19 |
| } |
20 |
| |
21 |
92253
| public MixableCBClausePB(IVecInt ps, ILits voc) {
|
22 |
92253
| super(ps, voc);
|
23 |
| } |
24 |
| |
25 |
73623
| public static MixableCBClausePB brandNewClause(UnitPropagationListener s, ILits voc,
|
26 |
| IVecInt literals) { |
27 |
73623
| MixableCBClausePB c = new MixableCBClausePB(literals, voc);
|
28 |
73623
| c.register();
|
29 |
73623
| return c;
|
30 |
| } |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
0
| public IVecInt computeAnImpliedClause() {
|
38 |
0
| return null;
|
39 |
| } |
40 |
| |
41 |
| |
42 |
| |
43 |
| |
44 |
2383083
| public BigInteger getCoef(int literal) {
|
45 |
2383083
| return BigInteger.ONE;
|
46 |
| } |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
24851
| public BigInteger[] getCoefs() {
|
52 |
24851
| BigInteger[] tmp = new BigInteger[size()];
|
53 |
24851
| for (int i = 0; i < tmp.length; i++)
|
54 |
390440
| tmp[i] = BigInteger.ONE;
|
55 |
24851
| return tmp;
|
56 |
| } |
57 |
| |
58 |
| |
59 |
| |
60 |
| |
61 |
213714
| public BigInteger getDegree() {
|
62 |
213714
| return BigInteger.ONE;
|
63 |
| } |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
24851
| public int[] getLits() {
|
69 |
24851
| int[] tmp = new int[size()];
|
70 |
24851
| System.arraycopy(lits, 0, tmp, 0, size());
|
71 |
24851
| return tmp;
|
72 |
| } |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
272326
| public ILits getVocabulary() {
|
78 |
272326
| return voc;
|
79 |
| } |
80 |
| |
81 |
| |
82 |
| |
83 |
| |
84 |
| |
85 |
| |
86 |
18630
| public void assertConstraint(UnitPropagationListener s) {
|
87 |
247475
| for (int i = 0; i < size(); i++)
|
88 |
247475
| if (getVocabulary().isUnassigned(get(i))) {
|
89 |
18630
| boolean ret = s.enqueue(get(i), this);
|
90 |
| assert ret; |
91 |
18630
| break;
|
92 |
| } |
93 |
| } |
94 |
| |
95 |
| |
96 |
| } |