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.reader.csp; |
26 |
|
|
27 |
|
import java.util.Map; |
28 |
|
|
29 |
|
import org.sat4j.core.VecInt; |
30 |
|
import org.sat4j.specs.ContradictionException; |
31 |
|
import org.sat4j.specs.ISolver; |
32 |
|
import org.sat4j.specs.IVec; |
33 |
|
import org.sat4j.specs.IVecInt; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 2 |
Complexity Density: 1 |
|
35 |
|
public class DirectEncoding implements Encoding { |
36 |
|
|
37 |
|
private final IVecInt clause = new VecInt(); |
38 |
|
|
39 |
|
private static final Encoding instance = new DirectEncoding(); |
40 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
41 |
0
|
private DirectEncoding() {... |
42 |
|
|
43 |
|
} |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0
|
public static Encoding instance() {... |
46 |
0
|
return instance; |
47 |
|
} |
48 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
49 |
0
|
public void onFinish(ISolver solver, IVec<Var> scope) {... |
50 |
|
} |
51 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
52 |
0
|
public void onInit(ISolver solver, IVec<Var> scope) {... |
53 |
|
} |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0,33 |
|
55 |
0
|
public void onNogood(ISolver solver, IVec<Var> scope,... |
56 |
|
Map<Evaluable, Integer> tuple) throws ContradictionException { |
57 |
0
|
clause.clear(); |
58 |
0
|
Var v; |
59 |
0
|
for (int i = 0; i < scope.size(); i++) { |
60 |
0
|
v = scope.get(i); |
61 |
0
|
clause.push(-v.translate(tuple.get(v))); |
62 |
|
} |
63 |
0
|
solver.addClause(clause); |
64 |
|
|
65 |
|
} |
66 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
67 |
0
|
public void onSupport(ISolver solver, IVec<Var> scope,... |
68 |
|
Map<Evaluable, Integer> tuple) { |
69 |
|
} |
70 |
|
|
71 |
|
} |