1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
package org.sat4j.minisat; |
8 |
|
|
9 |
|
import java.math.BigInteger; |
10 |
|
|
11 |
|
import org.sat4j.core.Vec; |
12 |
|
import org.sat4j.core.VecInt; |
13 |
|
import org.sat4j.minisat.core.ILits; |
14 |
|
import org.sat4j.minisat.core.Solver; |
15 |
|
import org.sat4j.specs.ContradictionException; |
16 |
|
import org.sat4j.specs.ISolver; |
17 |
|
import org.sat4j.specs.IVec; |
18 |
|
import org.sat4j.specs.IVecInt; |
19 |
|
|
20 |
|
|
21 |
|
@author |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
|
|
| 91,4% |
Uncovered Elements: 3 (35) |
Complexity: 3 |
Complexity Density: 0,19 |
|
26 |
|
public class CounterPBConstrWithPBConstrLearningOnCNFTest extends |
27 |
|
AbstractM2Test { |
28 |
|
|
29 |
|
|
30 |
|
@param |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
32 |
103
|
public CounterPBConstrWithPBConstrLearningOnCNFTest(String arg0) {... |
33 |
103
|
super(arg0); |
34 |
|
} |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
36 |
103
|
@Override... |
37 |
|
protected ISolver createSolver() { |
38 |
103
|
return SolverFactory.newMiniOPBMax(); |
39 |
|
} |
40 |
|
|
|
|
| 89,5% |
Uncovered Elements: 2 (19) |
Complexity: 2 |
Complexity Density: 0,11 |
1
PASS
|
|
41 |
1
|
public void testPropagation() {... |
42 |
1
|
solver.newVar(3); |
43 |
1
|
IVecInt lits = new VecInt(); |
44 |
1
|
lits.push(1); |
45 |
1
|
lits.push(2); |
46 |
1
|
lits.push(3); |
47 |
1
|
IVec<BigInteger> coefs = new Vec<BigInteger>(); |
48 |
1
|
coefs.growTo(lits.size(), BigInteger.ONE); |
49 |
1
|
Solver<ILits> mysolver = (Solver<ILits>) solver; |
50 |
1
|
try { |
51 |
1
|
mysolver.addPseudoBoolean(lits, coefs, true, BigInteger.ONE); |
52 |
1
|
mysolver.assume(3); |
53 |
1
|
assertNull(mysolver.propagate()); |
54 |
1
|
assertTrue(mysolver.getVocabulary().isSatisfied(3)); |
55 |
1
|
mysolver.assume(5); |
56 |
1
|
assertNull(mysolver.propagate()); |
57 |
1
|
assertTrue(mysolver.getVocabulary().isSatisfied(5)); |
58 |
1
|
assertTrue(mysolver.getVocabulary().isSatisfied(6)); |
59 |
|
} catch (ContradictionException e) { |
60 |
0
|
e.printStackTrace(); |
61 |
0
|
fail(); |
62 |
|
} |
63 |
|
|
64 |
|
} |
65 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0,2 |
1
PASS
|
|
66 |
1
|
public void testPropagation2() {... |
67 |
1
|
solver.newVar(3); |
68 |
1
|
IVecInt lits = new VecInt(); |
69 |
1
|
lits.push(1); |
70 |
1
|
lits.push(2); |
71 |
1
|
lits.push(3); |
72 |
1
|
IVec<BigInteger> coefs = new Vec<BigInteger>(); |
73 |
1
|
coefs.growTo(lits.size(), BigInteger.ONE); |
74 |
1
|
try { |
75 |
1
|
solver.addPseudoBoolean(lits, coefs, true, BigInteger.valueOf(4)); |
76 |
0
|
fail(); |
77 |
|
} catch (ContradictionException e) { |
78 |
|
|
79 |
|
} |
80 |
|
} |
81 |
|
|
82 |
|
} |