本文整理汇总了Java中kodkod.instance.Instance.tuples方法的典型用法代码示例。如果您正苦于以下问题:Java Instance.tuples方法的具体用法?Java Instance.tuples怎么用?Java Instance.tuples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kodkod.instance.Instance
的用法示例。
在下文中一共展示了Instance.tuples方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIntersectionMultiplicity
import kodkod.instance.Instance; //导入方法依赖的package包/类
private final void testIntersectionMultiplicity(Multiplicity mult, Relation p, Relation q, Tuple intersection) {
final Instance m = solve(p.intersection(q).apply(mult));
assertNotNull(m);
final Set<Tuple> ps = m.tuples(p), qs = m.tuples(q);
assertFalse(ps.isEmpty());
assertFalse(qs.isEmpty());
assertTrue(ps.contains(intersection));
assertTrue(qs.contains(intersection));
}
示例2: testIntersectionMultiplicity
import kodkod.instance.Instance; //导入方法依赖的package包/类
private final void testIntersectionMultiplicity(Multiplicity mult, Relation p, Relation q, Tuple intersection) {
final Instance m = solve(p.intersection(q).apply(mult));
assertNotNull(m);
final Set<Tuple> ps = m.tuples(p), qs = m.tuples(q);
assertFalse(ps.isEmpty());
assertFalse(qs.isEmpty());
assertTrue(ps.contains(intersection));
assertTrue(qs.contains(intersection));
}
示例3: evalS
import kodkod.instance.Instance; //导入方法依赖的package包/类
protected int evalS(Solution sol) {
Instance inst = sol.instance();
TupleSet x = inst.tuples(inst.skolems().iterator().next());
return (Integer) x.iterator().next().atom(0);
}
示例4: testFelix_02222008
import kodkod.instance.Instance; //导入方法依赖的package包/类
public final void testFelix_02222008() {
List<String> atomlist = Arrays.asList("X1", "X2", "X3");
Universe universe = new Universe(atomlist);
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
Relation x = Relation.unary("X");
TupleSet x_upper = factory.noneOf(1);
x_upper.add(factory.tuple("X1"));
x_upper.add(factory.tuple("X2"));
x_upper.add(factory.tuple("X3"));
bounds.bound(x, x_upper);
Variable a = Variable.unary("a");
Variable b = Variable.unary("b");
Variable c = Variable.unary("c");
Formula goal = x.lone().not().and(b.union(c).eq(a).forSome(c.oneOf(x)).forAll(b.oneOf(x)).forSome(a.setOf(x)));
Solver solver = new Solver();
solver.options().setSolver(SATFactory.DefaultSAT4J);
solver.options().setBitwidth(4);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
solver.options().setSymmetryBreaking(0);
solver.options().setSkolemDepth(2);
Iterator<Solution> itr = solver.solveAll(goal, bounds);
int sols = 0;
while (itr.hasNext()) {
Solution sol = itr.next();
Instance inst = sol.instance();
if (inst == null)
break;
sols++;
for (Relation rel : inst.relations()) {
if (rel != x) {
if (rel.arity() == 1) { // rel = a
assertEquals(inst.tuples(x), inst.tuples(rel));
} else { // rel = c
final TupleSet dom = factory.noneOf(1);
for (Tuple t : inst.tuples(rel)) {
dom.add(factory.tuple(t.atom(0)));
}
assertEquals(inst.tuples(x), dom);
}
}
}
}
assertEquals(3, sols);
}
示例5: testFelix_02222008
import kodkod.instance.Instance; //导入方法依赖的package包/类
@Test
public final void testFelix_02222008() {
List<String> atomlist = Arrays.asList("X1", "X2", "X3");
Universe universe = new Universe(atomlist);
TupleFactory factory = universe.factory();
Bounds bounds = new Bounds(universe);
Relation x = Relation.unary("X");
TupleSet x_upper = factory.noneOf(1);
x_upper.add(factory.tuple("X1"));
x_upper.add(factory.tuple("X2"));
x_upper.add(factory.tuple("X3"));
bounds.bound(x, x_upper);
Variable a = Variable.unary("a");
Variable b = Variable.unary("b");
Variable c = Variable.unary("c");
Formula goal = x.lone().not().and(b.union(c).eq(a).forSome(c.oneOf(x)).forAll(b.oneOf(x)).forSome(a.setOf(x)));
Solver solver = new Solver();
solver.options().setSolver(SATFactory.DefaultSAT4J);
solver.options().setBitwidth(4);
solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT);
solver.options().setSymmetryBreaking(0);
solver.options().setSkolemDepth(2);
Iterator<Solution> itr = solver.solveAll(goal, bounds);
int sols = 0;
while(itr.hasNext()) {
Solution sol = itr.next();
Instance inst = sol.instance();
if (inst==null) break;
sols++;
for(Relation rel : inst.relations()) {
if (rel!=x) {
if( rel.arity()==1) { // rel = a
assertEquals(inst.tuples(x), inst.tuples(rel));
} else { // rel = c
final TupleSet dom = factory.noneOf(1);
for(Tuple t : inst.tuples(rel)) {
dom.add(factory.tuple(t.atom(0)));
}
assertEquals(inst.tuples(x), dom);
}
}
}
}
assertEquals(3, sols);
}