1 |
| package org.sat4j.minisat.constraints.pb; |
2 |
| |
3 |
| import java.math.BigInteger; |
4 |
| |
5 |
| import org.sat4j.minisat.constraints.cnf.WLClause; |
6 |
| import org.sat4j.minisat.core.ILits; |
7 |
| import org.sat4j.minisat.core.UnitPropagationListener; |
8 |
| import org.sat4j.specs.IVecInt; |
9 |
| |
10 |
| public class WLClausePB extends WLClause implements PBConstr { |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| private static final long serialVersionUID = 1L; |
16 |
| |
17 |
598075
| public WLClausePB(IVecInt ps, ILits voc) {
|
18 |
598075
| super(ps, voc);
|
19 |
| |
20 |
| } |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
18796517
| public BigInteger getCoef(int literal) {
|
28 |
18796517
| return BigInteger.ONE;
|
29 |
| } |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
1648321
| public BigInteger getDegree() {
|
37 |
1648321
| return BigInteger.ONE;
|
38 |
| } |
39 |
| |
40 |
239387
| public BigInteger[] getCoefs() {
|
41 |
239387
| BigInteger[] tmp = new BigInteger[size()];
|
42 |
239387
| for (int i = 0; i < tmp.length; i++)
|
43 |
4674854
| tmp[i] = BigInteger.ONE;
|
44 |
239387
| return tmp;
|
45 |
| } |
46 |
| |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
| |
59 |
| |
60 |
369775
| public static WLClausePB brandNewClause(UnitPropagationListener s,
|
61 |
| ILits voc, IVecInt literals) { |
62 |
369775
| WLClausePB c = new WLClausePB(literals, voc);
|
63 |
369775
| c.register();
|
64 |
369775
| return c;
|
65 |
| } |
66 |
| |
67 |
228300
| public void assertConstraint(UnitPropagationListener s) {
|
68 |
3130790
| for (int i = 0; i < size(); i++)
|
69 |
3130790
| if (getVocabulary().isUnassigned(get(i))) {
|
70 |
228300
| boolean ret = s.enqueue(get(i), this);
|
71 |
| assert ret; |
72 |
228300
| break;
|
73 |
| } |
74 |
| } |
75 |
| |
76 |
0
| public IVecInt computeAnImpliedClause() {
|
77 |
0
| return null;
|
78 |
| } |
79 |
| |
80 |
| |
81 |
| |
82 |
| } |