| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
package org.sat4j.tools; |
| 27 |
|
|
| 28 |
|
import org.sat4j.core.VecInt; |
| 29 |
|
import org.sat4j.specs.ContradictionException; |
| 30 |
|
import org.sat4j.specs.ISolver; |
| 31 |
|
import org.sat4j.specs.IVecInt; |
| 32 |
|
import org.sat4j.specs.TimeoutException; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@author |
| 52 |
|
|
|
|
|
| 53,6% |
Uncovered Elements: 13 (28) |
Complexity: 5 |
Complexity Density: 0,47 |
|
| 53 |
|
public class ModelIterator extends SolverDecorator { |
| 54 |
|
|
| 55 |
|
private static final long serialVersionUID = 1L; |
| 56 |
|
|
| 57 |
|
private boolean trivialfalsity = false; |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@param |
| 61 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
1
|
public ModelIterator(ISolver solver) {... |
| 63 |
1
|
super(solver); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
@see |
| 70 |
|
|
|
|
|
| 87,5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0,38 |
|
| 71 |
6
|
@Override... |
| 72 |
|
public int[] model() { |
| 73 |
6
|
int[] last = super.model(); |
| 74 |
6
|
IVecInt clause = new VecInt(last.length); |
| 75 |
6
|
for (int q : last) { |
| 76 |
18
|
clause.push(-q); |
| 77 |
|
} |
| 78 |
6
|
try { |
| 79 |
|
|
| 80 |
6
|
addClause(clause); |
| 81 |
|
} catch (ContradictionException e) { |
| 82 |
0
|
trivialfalsity = true; |
| 83 |
|
} |
| 84 |
6
|
return last; |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
@see |
| 91 |
|
|
|
|
|
| 66,7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
| 92 |
7
|
@Override... |
| 93 |
|
public boolean isSatisfiable() throws TimeoutException { |
| 94 |
7
|
if (trivialfalsity) { |
| 95 |
0
|
return false; |
| 96 |
|
} |
| 97 |
7
|
trivialfalsity = false; |
| 98 |
7
|
return super.isSatisfiable(); |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
|
@see |
| 105 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
| 106 |
0
|
@Override... |
| 107 |
|
public boolean isSatisfiable(IVecInt assumps) throws TimeoutException { |
| 108 |
0
|
if (trivialfalsity) { |
| 109 |
0
|
return false; |
| 110 |
|
} |
| 111 |
0
|
trivialfalsity = false; |
| 112 |
0
|
return super.isSatisfiable(assumps); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@see |
| 119 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 120 |
0
|
@Override... |
| 121 |
|
public void reset() { |
| 122 |
0
|
trivialfalsity = false; |
| 123 |
0
|
super.reset(); |
| 124 |
|
} |
| 125 |
|
} |