Java Code Examples for kodkod.ast.Relation#join()
The following examples show how to use
kodkod.ast.Relation#join() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ALG195_1.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Parametrization of axioms 16-22. * * @requires e is unary, h is binary */ Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr0); // op2(e,op2(e,e)) final Expression expr3 = expr2.join(expr2.join(op2)); // op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Expression expr3a = expr3.join(op2); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...) final Expression expr4 = e.join(expr3a); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e))) final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a)); // h(e11) = op2(e,e) final Formula f1 = e1[1].join(h).eq(expr1); // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Formula f2 = e1[2].join(h).eq(expr3); // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) final Formula f3 = e1[3].join(h).eq(expr4); // h(e14) = op2(e,op2(e,e)) final Formula f4 = e1[4].join(h).eq(expr2); // h1(e15) = e final Formula f5 = e1[5].join(h).eq(e); // h(e16) = // op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e))) final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2))); return f0.and(f1).and(f2).and(f3).and(f4).and(f5).and(f6); }
Example 2
Source File: ALG197.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Parametrization of axioms 16-22. * * @requires e is unary, h is binary */ @Override Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr1.join(op2)); // op2(op2(e,e),op2(e,e)) final Expression expr3 = expr2.join(expr0); // op2(e,op2(op2(e,e),op2(e,e))) // h(e10) = op2(e,op2(e,e)) final Formula f0 = e1[0].join(h).eq(expr1.join(expr0)); // h(e11) = op2(op2(e,e),op2(e,e)) final Formula f1 = e1[1].join(h).eq(expr2); // h(e12) = op2(op2(op2(e,e),op2(e,e)),op2(e,e)) final Formula f2 = e1[2].join(h).eq(expr1.join(expr2.join(op2))); // h(e13) = op2(e,op2(op2(e,e),op2(e,e))) final Formula f3 = e1[3].join(h).eq(expr3); // h(e14) = op2(e,op2(e,op2(op2(e,e),op2(e,e)))) final Formula f4 = e1[4].join(h).eq(expr3.join(expr0)); // h(e15) = op2(e,e) final Formula f5 = e1[5].join(h).eq(expr1); return Formula.and(f0, f1, f2, f3, f4, f5); }
Example 3
Source File: ALG195.java From org.alloytools.alloy with Apache License 2.0 | 6 votes |
/** * Parametrization of axioms 16-22. * * @requires e is unary, h is binary */ @Override Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr0); // op2(e,op2(e,e)) final Expression expr3 = expr2.join(expr2.join(op2)); // op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Expression expr3a = expr3.join(op2); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...) final Expression expr4 = e.join(expr3a); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e))) final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a)); // h(e11) = op2(e,e) final Formula f1 = e1[1].join(h).eq(expr1); // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Formula f2 = e1[2].join(h).eq(expr3); // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) final Formula f3 = e1[3].join(h).eq(expr4); // h(e14) = op2(e,op2(e,e)) final Formula f4 = e1[4].join(h).eq(expr2); // h(e16) = // op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e))) final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2))); return and(f0, f1, f2, f3, f4, f6); }
Example 4
Source File: ALG195_1.java From kodkod with MIT License | 6 votes |
/** * Parametrization of axioms 16-22. * @requires e is unary, h is binary */ Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr0); // op2(e,op2(e,e)) final Expression expr3 = expr2.join(expr2.join(op2)); // op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Expression expr3a = expr3.join(op2); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...) final Expression expr4 = e.join(expr3a); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e))) final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a)); // h(e11) = op2(e,e) final Formula f1 = e1[1].join(h).eq(expr1); // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Formula f2 = e1[2].join(h).eq(expr3); // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) final Formula f3 = e1[3].join(h).eq(expr4); // h(e14) = op2(e,op2(e,e)) final Formula f4 = e1[4].join(h).eq(expr2); // h1(e15) = e final Formula f5 = e1[5].join(h).eq(e); // h(e16) = op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e))) final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2))); return f0.and(f1).and(f2).and(f3).and(f4).and(f5).and(f6); }
Example 5
Source File: ALG197.java From kodkod with MIT License | 6 votes |
/** * Parametrization of axioms 16-22. * @requires e is unary, h is binary */ Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr1.join(op2)); // op2(op2(e,e),op2(e,e)) final Expression expr3 = expr2.join(expr0); // op2(e,op2(op2(e,e),op2(e,e))) // h(e10) = op2(e,op2(e,e)) final Formula f0 = e1[0].join(h).eq(expr1.join(expr0)); // h(e11) = op2(op2(e,e),op2(e,e)) final Formula f1 = e1[1].join(h).eq(expr2); // h(e12) = op2(op2(op2(e,e),op2(e,e)),op2(e,e)) final Formula f2 = e1[2].join(h).eq(expr1.join(expr2.join(op2))); // h(e13) = op2(e,op2(op2(e,e),op2(e,e))) final Formula f3 = e1[3].join(h).eq(expr3); // h(e14) = op2(e,op2(e,op2(op2(e,e),op2(e,e)))) final Formula f4 = e1[4].join(h).eq(expr3.join(expr0)); // h(e15) = op2(e,e) final Formula f5 = e1[5].join(h).eq(expr1); return Formula.and(f0, f1, f2, f3, f4, f5); }
Example 6
Source File: ALG195.java From kodkod with MIT License | 6 votes |
/** * Parametrization of axioms 16-22. * @requires e is unary, h is binary */ Formula ax16_22(Relation e, Relation h) { final Expression expr0 = e.join(op2); // op2(e,...) final Expression expr1 = e.join(expr0); // op2(e,e) final Expression expr2 = expr1.join(expr0); // op2(e,op2(e,e)) final Expression expr3 = expr2.join(expr2.join(op2)); // op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Expression expr3a = expr3.join(op2); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),...) final Expression expr4 = e.join(expr3a); // op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) // h(e10) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),op2(e,op2(e,e))) final Formula f0 = e1[0].join(h).eq(expr2.join(expr3a)); // h(e11) = op2(e,e) final Formula f1 = e1[1].join(h).eq(expr1); // h(e12) = op2(op2(e,op2(e,e)),op2(e,op2(e,e))) final Formula f2 = e1[2].join(h).eq(expr3); // h(e13) = op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e) final Formula f3 = e1[3].join(h).eq(expr4); // h(e14) = op2(e,op2(e,e)) final Formula f4 = e1[4].join(h).eq(expr2); // h(e16) = op2(op2(op2(op2(e,op2(e,e)),op2(e,op2(e,e))),e),op2(e,op2(e,e))) final Formula f6 = e1[6].join(h).eq(expr2.join(expr4.join(op2))); return and(f0, f1, f2, f3, f4, f6); }
Example 7
Source File: ALG195_1.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Parametrization of axioms 3 and 6. * * @requires s is unary, op is ternary */ private static Formula ax3and6(Relation[] e, Relation op) { Formula f = Formula.TRUE; for (Relation x : e) { for (Relation y : e) { Expression expr0 = x.join(y.join(op)); // op(y,x) Expression expr1 = y.join(expr0.join(op)); // op(op(y,x),y) Expression expr2 = y.join(expr1.join(op)); // op(op(op(y,x),y),y) f = f.and(expr2.eq(x)); } } return f; }
Example 8
Source File: ALG195_1.java From kodkod with MIT License | 5 votes |
/** * Parametrization of axioms 3 and 6. * @requires s is unary, op is ternary */ private static Formula ax3and6(Relation[] e, Relation op) { Formula f = Formula.TRUE; for( Relation x : e) { for (Relation y: e) { Expression expr0 = x.join(y.join(op)); // op(y,x) Expression expr1 = y.join(expr0.join(op)); // op(op(y,x),y) Expression expr2 = y.join(expr1.join(op)); // op(op(op(y,x),y),y) f = f.and(expr2.eq(x)); } } return f; }
Example 9
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
public final void testBGP_03172011() { Relation x5 = Relation.unary("s012"); Relation x8 = Relation.unary("zero"); Relation x9 = Relation.unary("one"); Relation x12 = Relation.nary("next", 2); Universe universe = new Universe(Arrays.asList("0", "1", "2", "3")); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); bounds.boundExactly(x5, factory.setOf("0", "1", "2")); bounds.boundExactly(x8, factory.setOf("0")); bounds.bound(x9, factory.setOf("1"), factory.setOf("1", "2")); TupleSet x12_upper = factory.noneOf(2); x12_upper.add(factory.tuple("1", "2")); x12_upper.add(factory.tuple("2", "3")); bounds.boundExactly(x12, x12_upper); Variable x714 = Variable.unary("x714"); Decls x713 = x714.oneOf(x8.union(x9)); Variable x720 = Variable.unary("x720"); Expression x723 = x8.union(x9); Expression x724 = x9.join(x12); Expression x722 = x723.union(x724); Expression x721 = x722.difference(x714); Decls x719 = x720.oneOf(x721); Variable x727 = Variable.unary("x727"); Expression x732 = x714.union(x720); Expression x728 = x5.difference(x732); Decls x726 = x727.oneOf(x728); Variable x735 = Variable.unary("x735"); Decls x734 = x735.oneOf(x8); Variable x893 = Variable.unary("x893"); Decls x892 = x893.oneOf(x727); Formula x894 = x720.no(); Formula x891 = x894.forAll(x892); Formula x712 = x891.forSome(x713.and(x719).and(x726).and(x734)); Formula x267 = Formula.FALSE.or(x712); Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); solver.options().setBitwidth(4); // solver.options().setFlatten(false); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); solver.options().setSymmetryBreaking(20); solver.options().setSkolemDepth(0); final Solution sol = solver.solve(x267, bounds); assertEquals(sol.outcome(), Solution.Outcome.TRIVIALLY_UNSATISFIABLE); }
Example 10
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
public final void testFelix_11122006() { Relation x0 = Relation.nary("Q", 1); Relation x1 = Relation.nary("B", 1); Relation x2 = Relation.nary("A", 1); Relation x3 = Relation.nary("QQ", 3); List<String> atomlist = Arrays.asList("A", "B", "Q"); Universe universe = new Universe(atomlist); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); TupleSet x0_upper = factory.noneOf(1); x0_upper.add(factory.tuple("Q")); bounds.boundExactly(x0, x0_upper); TupleSet x1_upper = factory.noneOf(1); x1_upper.add(factory.tuple("B")); bounds.boundExactly(x1, x1_upper); TupleSet x2_upper = factory.noneOf(1); x2_upper.add(factory.tuple("A")); bounds.boundExactly(x2, x2_upper); TupleSet x3_upper = factory.noneOf(3); x3_upper.add(factory.tuple("Q").product(factory.tuple("A")).product(factory.tuple("A"))); x3_upper.add(factory.tuple("Q").product(factory.tuple("B")).product(factory.tuple("B"))); bounds.bound(x3, x3_upper); Expression x7 = x2.product(x2); Expression x8 = x0.join(x3); Formula x6 = x7.in(x8); Formula x5 = x6.not(); Expression x18 = x1.product(x1); Expression x17 = x7.union(x18); Expression x16 = x0.product(x17); Formula x15 = x3.in(x16); Formula x4 = x5.and(x15); Solver solver = new Solver(); solver.options().setSolver(SATFactory.DefaultSAT4J); solver.options().setBitwidth(4); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); // System.out.println(bounds); // System.out.println(x4); Solution sol = solver.solve(x4, bounds); assertEquals(sol.outcome(), Solution.Outcome.SATISFIABLE); // System.out.println(sol.toString()); }
Example 11
Source File: BugTests.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
public final void testGreg_01192006() { // circular linked list Relation Entry = Relation.unary("Entry"); Relation head = Relation.unary("head"); Relation next = Relation.binary("next"); Formula nextFun = next.function(Entry, Entry); // bijection between indices and entries in linked list Relation Index = Relation.unary("Index"); Relation index2Entry = Relation.binary("index2Entry"); Expression entries = head.join(next.closure()); Variable e = Variable.unary("e"); Expression preImage = index2Entry.join(e); Formula index2EntryBij = e.in(entries).implies(preImage.one()).and(e.in(entries).not().implies(preImage.no())).forAll(e.oneOf(Entry)); // try to force list to have three distinct entries Variable e1 = Variable.unary("e1"); Variable e2 = Variable.unary("e2"); Variable e3 = Variable.unary("e3"); Formula threeEntries = e1.eq(e2).not().and(e1.eq(e3).not()).and(e2.eq(e3).not()).forSome(e1.oneOf(entries).and(e2.oneOf(entries).and(e3.oneOf(entries)))); Formula simulate = head.one().and(nextFun).and(index2EntryBij).and(threeEntries); Object Entry0 = "Entry0"; Object Entry1 = "Entry1"; Object Entry2 = "Entry2"; Object Entry3 = "Entry3"; Object Index0 = "Index0"; Object Index1 = "Index1"; Object Index2 = "Index2"; Object Index3 = "Index3"; Universe univ = new Universe(Arrays.asList(Entry0, Entry1, Entry2, Entry3, Index0, Index1, Index2, Index3)); TupleFactory factory = univ.factory(); TupleSet entryTuples = factory.setOf(Entry0, Entry1, Entry2, Entry3); TupleSet indexTuples = factory.setOf(Index0, Index1, Index2, Index3); Instance instance = new Instance(univ); instance.add(Entry, entryTuples); instance.add(head, factory.setOf(Entry0)); instance.add(Index, indexTuples); Tuple next0 = factory.tuple(Entry0, Entry1); Tuple next1 = factory.tuple(Entry1, Entry2); Tuple next2 = factory.tuple(Entry2, Entry3); Tuple next3 = factory.tuple(Entry3, Entry0); instance.add(next, factory.setOf(next0, next1, next2, next3)); Tuple i2e0 = factory.tuple(Index0, Entry0); Tuple i2e1 = factory.tuple(Index1, Entry1); Tuple i2e2 = factory.tuple(Index2, Entry2); Tuple i2e3 = factory.tuple(Index3, Entry3); instance.add(index2Entry, factory.setOf(i2e0, i2e1, i2e2, i2e3)); Evaluator eval = new Evaluator(instance); assertTrue(eval.evaluate(simulate)); Bounds bounds = new Bounds(univ); bounds.boundExactly(Entry, entryTuples); bounds.bound(head, entryTuples); bounds.bound(next, entryTuples.product(entryTuples)); bounds.bound(Index, indexTuples); bounds.bound(index2Entry, indexTuples.product(entryTuples)); // Solver solver = new Solver(SATSolverName.Default); // System.out.println(simulate); // System.out.println(bounds); // System.out.println(instance); instance = solver.solve(simulate, bounds).instance(); // System.out.println(instance); assertNotNull(instance); }
Example 12
Source File: RegressionTests.java From kodkod with MIT License | 4 votes |
@Test public final void testBGP_03172011() { Relation x5 = Relation.unary("s012"); Relation x8 = Relation.unary("zero"); Relation x9 = Relation.unary("one"); Relation x12 = Relation.nary("next", 2); Universe universe = new Universe(Arrays.asList( "0", "1", "2", "3")); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); bounds.boundExactly(x5, factory.setOf("0","1","2")); bounds.boundExactly(x8, factory.setOf("0")); bounds.bound(x9, factory.setOf("1"), factory.setOf("1","2")); TupleSet x12_upper = factory.noneOf(2); x12_upper.add(factory.tuple("1","2")); x12_upper.add(factory.tuple("2","3")); bounds.boundExactly(x12, x12_upper); Variable x714 = Variable.unary("x714"); Decls x713 = x714.oneOf(x8.union(x9)); Variable x720 = Variable.unary("x720"); Expression x723 = x8.union(x9); Expression x724 = x9.join(x12); Expression x722 = x723.union(x724); Expression x721 = x722.difference(x714); Decls x719 = x720.oneOf(x721); Variable x727 = Variable.unary("x727"); Expression x732 = x714.union(x720); Expression x728 = x5.difference(x732); Decls x726 = x727.oneOf(x728); Variable x735 = Variable.unary("x735"); Decls x734 = x735.oneOf(x8); Variable x893 = Variable.unary("x893"); Decls x892 = x893.oneOf(x727); Formula x894 = x720.no(); Formula x891 = x894.forAll(x892); Formula x712 = x891.forSome(x713.and(x719).and(x726).and(x734)); Formula x267 = Formula.FALSE.or(x712); Solver solver = new Solver(); solver.options().setSolver(SATFactory.MiniSat); solver.options().setBitwidth(4); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); solver.options().setSymmetryBreaking(20); solver.options().setSkolemDepth(0); final Solution sol = solver.solve(x267, bounds); assertEquals(sol.outcome(), Solution.Outcome.TRIVIALLY_UNSATISFIABLE); }
Example 13
Source File: RegressionTests.java From kodkod with MIT License | 4 votes |
@Test public final void testFelix_11122006() { Relation x0 = Relation.nary("Q", 1); Relation x1 = Relation.nary("B", 1); Relation x2 = Relation.nary("A", 1); Relation x3 = Relation.nary("QQ", 3); List<String> atomlist = Arrays.asList("A", "B", "Q"); Universe universe = new Universe(atomlist); TupleFactory factory = universe.factory(); Bounds bounds = new Bounds(universe); TupleSet x0_upper = factory.noneOf(1); x0_upper.add(factory.tuple("Q")); bounds.boundExactly(x0, x0_upper); TupleSet x1_upper = factory.noneOf(1); x1_upper.add(factory.tuple("B")); bounds.boundExactly(x1, x1_upper); TupleSet x2_upper = factory.noneOf(1); x2_upper.add(factory.tuple("A")); bounds.boundExactly(x2, x2_upper); TupleSet x3_upper = factory.noneOf(3); x3_upper.add(factory.tuple("Q").product(factory.tuple("A")).product(factory.tuple("A"))); x3_upper.add(factory.tuple("Q").product(factory.tuple("B")).product(factory.tuple("B"))); bounds.bound(x3, x3_upper); Expression x7=x2.product(x2); Expression x8=x0.join(x3); Formula x6=x7.in(x8); Formula x5=x6.not(); Expression x18=x1.product(x1); Expression x17=x7.union(x18); Expression x16=x0.product(x17); Formula x15=x3.in(x16); Formula x4=x5.and(x15); Solver solver = new Solver(); solver.options().setSolver(SATFactory.DefaultSAT4J); solver.options().setBitwidth(4); solver.options().setIntEncoding(Options.IntEncoding.TWOSCOMPLEMENT); // System.out.println(bounds); // System.out.println(x4); Solution sol = solver.solve(x4,bounds); assertEquals(sol.outcome(), Solution.Outcome.SATISFIABLE); // System.out.println(sol.toString()); }
Example 14
Source File: RegressionTests.java From kodkod with MIT License | 4 votes |
@Test public final void testGreg_01192006() { // circular linked list Relation Entry = Relation.unary("Entry"); Relation head = Relation.unary("head"); Relation next = Relation.binary("next"); Formula nextFun = next.function(Entry, Entry); // bijection between indices and entries in linked list Relation Index = Relation.unary("Index"); Relation index2Entry = Relation.binary("index2Entry"); Expression entries = head.join(next.closure()); Variable e = Variable.unary("e"); Expression preImage = index2Entry.join(e); Formula index2EntryBij = e.in(entries).implies(preImage.one()).and( e.in(entries).not().implies(preImage.no())).forAll(e.oneOf(Entry)); // try to force list to have three distinct entries Variable e1 = Variable.unary("e1"); Variable e2 = Variable.unary("e2"); Variable e3 = Variable.unary("e3"); Formula threeEntries = e1.eq(e2).not().and(e1.eq(e3).not()).and(e2.eq(e3).not()). forSome(e1.oneOf(entries).and(e2.oneOf(entries).and(e3.oneOf(entries)))); Formula simulate = head.one().and(nextFun).and(index2EntryBij).and(threeEntries); Object Entry0 = "Entry0"; Object Entry1 = "Entry1"; Object Entry2 = "Entry2"; Object Entry3 = "Entry3"; Object Index0 = "Index0"; Object Index1 = "Index1"; Object Index2 = "Index2"; Object Index3 = "Index3"; Universe univ = new Universe( Arrays.asList(Entry0, Entry1, Entry2, Entry3, Index0, Index1, Index2, Index3)); TupleFactory factory = univ.factory(); TupleSet entryTuples = factory.setOf(Entry0, Entry1, Entry2, Entry3); TupleSet indexTuples = factory.setOf(Index0, Index1, Index2, Index3); Instance instance = new Instance(univ); instance.add(Entry, entryTuples); instance.add(head, factory.setOf(Entry0)); instance.add(Index, indexTuples); Tuple next0 = factory.tuple(Entry0, Entry1); Tuple next1 = factory.tuple(Entry1, Entry2); Tuple next2 = factory.tuple(Entry2, Entry3); Tuple next3 = factory.tuple(Entry3, Entry0); instance.add(next, factory.setOf(next0, next1, next2, next3)); Tuple i2e0 = factory.tuple(Index0, Entry0); Tuple i2e1 = factory.tuple(Index1, Entry1); Tuple i2e2 = factory.tuple(Index2, Entry2); Tuple i2e3 = factory.tuple(Index3, Entry3); instance.add(index2Entry, factory.setOf(i2e0, i2e1, i2e2, i2e3)); Evaluator eval = new Evaluator(instance); assertTrue(eval.evaluate(simulate)); Bounds bounds = new Bounds(univ); bounds.boundExactly(Entry, entryTuples); bounds.bound(head, entryTuples); bounds.bound(next, entryTuples.product(entryTuples)); bounds.bound(Index, indexTuples); bounds.bound(index2Entry, indexTuples.product(entryTuples)); // Solver solver = new Solver(SATSolverName.Default); // System.out.println(simulate); // System.out.println(bounds); // System.out.println(instance); instance = solver.solve(simulate, bounds).instance(); // System.out.println(instance); assertNotNull(instance); }