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