| 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 |
|
package org.sat4j.minisat.orders; |
| 26 |
|
|
| 27 |
|
import static org.sat4j.minisat.core.LiteralsUtils.neg; |
| 28 |
|
import static org.sat4j.minisat.core.LiteralsUtils.var; |
| 29 |
|
|
| 30 |
|
import java.math.BigInteger; |
| 31 |
|
|
| 32 |
|
import org.sat4j.minisat.core.ILits; |
| 33 |
|
import org.sat4j.reader.ObjectiveFunction; |
| 34 |
|
import org.sat4j.specs.IVec; |
| 35 |
|
import org.sat4j.specs.IVecInt; |
| 36 |
|
|
|
|
|
| 38,2% |
Uncovered Elements: 21 (34) |
Complexity: 6 |
Complexity Density: 0,45 |
|
| 37 |
|
public class VarOrderHeapObjective extends VarOrderHeap<ILits> { |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
private static final long serialVersionUID = 1L; |
| 43 |
|
|
| 44 |
|
private ObjectiveFunction obj; |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public void setObjectiveFunction(ObjectiveFunction obj) {... |
| 47 |
0
|
this.obj = obj; |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 13,6% |
Uncovered Elements: 19 (22) |
Complexity: 5 |
Complexity Density: 0,36 |
|
| 50 |
6
|
@Override... |
| 51 |
|
public void init() { |
| 52 |
6
|
super.init(); |
| 53 |
6
|
if (obj != null) { |
| 54 |
0
|
IVecInt vars = obj.getVars(); |
| 55 |
0
|
IVec<BigInteger> coefs = obj.getCoeffs(); |
| 56 |
0
|
for (int i = 0; i < vars.size(); i++) { |
| 57 |
0
|
int p = lits.getFromPool(vars.get(i)); |
| 58 |
0
|
BigInteger c = coefs.get(i); |
| 59 |
0
|
if (c.signum() < 0) { |
| 60 |
0
|
p = neg(p); |
| 61 |
|
} |
| 62 |
0
|
int var = var(p); |
| 63 |
0
|
activity[var] = c.abs().doubleValue(); |
| 64 |
0
|
if (heap.inHeap(var)) |
| 65 |
0
|
heap.increase(var); |
| 66 |
0
|
phase[var] = neg(p); |
| 67 |
|
} |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
| 71 |
88290435
|
@Override... |
| 72 |
|
public void updateVar(int p) { |
| 73 |
88290435
|
int var = p >> 1; |
| 74 |
88290435
|
updateActivity(var); |
| 75 |
88290435
|
if (heap.inHeap(var)) |
| 76 |
19552586
|
heap.increase(var); |
| 77 |
|
} |
| 78 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 79 |
11779845
|
@Override... |
| 80 |
|
public void assignLiteral(int p) { |
| 81 |
11779845
|
phase[p>>1] = p; |
| 82 |
|
} |
| 83 |
|
} |