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.minisat.orders; |
27 |
|
|
28 |
|
import org.sat4j.minisat.core.ILits; |
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
|
33 |
|
|
|
|
| 84,6% |
Uncovered Elements: 4 (26) |
Complexity: 6 |
Complexity Density: 0,79 |
|
34 |
|
public class PureOrder extends VarOrder<ILits> { |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
private static final long serialVersionUID = 1L; |
40 |
|
|
41 |
|
private int period; |
42 |
|
|
43 |
|
private int cpt; |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
2
|
public PureOrder() {... |
46 |
2
|
this(20); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
2
|
public PureOrder(int p) {... |
50 |
2
|
setPeriod(p); |
51 |
|
} |
52 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
53 |
2
|
public final void setPeriod(int p) {... |
54 |
2
|
period = p; |
55 |
2
|
cpt = period; |
56 |
|
} |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0
|
public int getPeriod() {... |
59 |
0
|
return period; |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@see |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 6 |
Complexity Density: 0,75 |
|
67 |
13866630
|
@Override... |
68 |
|
public int select() { |
69 |
|
|
70 |
13866630
|
if (cpt < period) { |
71 |
13206313
|
cpt++; |
72 |
|
} else { |
73 |
|
|
74 |
660317
|
cpt = 0; |
75 |
660317
|
int nblits = 2 * lits.nVars(); |
76 |
65629202
|
for (int i = 2; i <= nblits; i++) { |
77 |
65320087
|
if (lits.isUnassigned(i) && lits.watches(i).size() > 0 |
78 |
|
&& lits.watches(i ^ 1).size() == 0) { |
79 |
351202
|
return i; |
80 |
|
} |
81 |
|
} |
82 |
|
} |
83 |
|
|
84 |
13515428
|
return super.select(); |
85 |
|
} |
86 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
87 |
0
|
@Override... |
88 |
|
public String toString() { |
89 |
0
|
return "tries to first branch on a single phase watched unassigned variable (pure literal if using a CB data structure) else VSIDS from MiniSAT"; |
90 |
|
} |
91 |
|
} |