| 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 org.sat4j.core.VecInt; |
| 28 |
|
import org.sat4j.specs.ContradictionException; |
| 29 |
|
import org.sat4j.specs.ISolver; |
| 30 |
|
import org.sat4j.specs.IVec; |
| 31 |
|
import org.sat4j.specs.IVecInt; |
| 32 |
|
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0,6 |
|
| 33 |
|
public class Nogoods implements Relation { |
| 34 |
|
|
| 35 |
|
private final int[][] tuples; |
| 36 |
|
|
| 37 |
|
private final int arity; |
| 38 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 39 |
0
|
public Nogoods(int arity, int nbtuples) {... |
| 40 |
0
|
tuples = new int[nbtuples][]; |
| 41 |
0
|
this.arity = arity; |
| 42 |
|
} |
| 43 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 44 |
0
|
public void addTuple(int index, int[] tuple) {... |
| 45 |
0
|
tuples[index] = tuple; |
| 46 |
|
} |
| 47 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0,5 |
|
| 48 |
0
|
public void toClause(ISolver solver, IVec<Var> scope, IVec<Evaluable> vars)... |
| 49 |
|
throws ContradictionException { |
| 50 |
0
|
IVecInt clause = new VecInt(); |
| 51 |
0
|
for (int i = 0; i < tuples.length; i++) { |
| 52 |
0
|
clause.clear(); |
| 53 |
0
|
for (int j = 0; j < scope.size(); j++) { |
| 54 |
0
|
clause.push(-scope.get(j).translate(tuples[i][j])); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
0
|
solver.addClause(clause); |
| 58 |
|
} |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 61 |
0
|
public int arity() {... |
| 62 |
0
|
return arity; |
| 63 |
|
} |
| 64 |
|
} |