Java Code Examples for kodkod.instance.TupleSet#remove()
The following examples show how to use
kodkod.instance.TupleSet#remove() .
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: ALG197.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-11, last formula of 14-15, and * first formula of 16-22). * * @return the bounds for the problem */ @Override public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); final TupleSet op1l = f.setOf(f.tuple("e16", "e16", "e15")); // axiom // 14, // line // 6 final TupleSet op2l = f.setOf(f.tuple("e26", "e26", "e25")); // axiom // 15, // line // 6 op1h.removeAll(f.area(f.tuple("e16", "e16", "e10"), f.tuple("e16", "e16", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e26", "e26", "e20"), f.tuple("e26", "e26", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e15", "e26")); // first line of axioms 16-22 for (int i = 0; i < 7; i++) { Tuple t = f.tuple("e16", "e2" + i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 2
Source File: SymmetryBreakingTest.java From org.alloytools.alloy with Apache License 2.0 | 5 votes |
public void testAcyclic() { bounds.bound(ac1, factory.area(factory.tuple("0", "0"), factory.tuple("4", "4"))); assertNotNull(solve(ac1.some().and(ac1.acyclic()))); assertPrimVarNum(10); bounds.bound(r1, factory.range(factory.tuple("0"), factory.tuple("4"))); assertNotNull(solve(ac1.join(r1).some().and(ac1.acyclic()))); assertPrimVarNum(10 + bounds.upperBound(r1).size()); TupleSet ac2b = factory.setOf("5", "6", "7", "8"); ac2b = ac2b.product(ac2b); bounds.bound(ac2, ac2b); assertNotNull(solve(ac1.difference(ac2).some().and(ac1.acyclic()).and(ac2.acyclic()))); assertPrimVarNum(10 + 6); bounds.boundExactly(r2, factory.setOf(factory.tuple("5", "6"))); assertNotNull(solve(ac2.join(r2).some().and(ac2.acyclic()))); final TupleSet ac3Bound = factory.allOf(2); ac3Bound.remove(factory.tuple("9", "9")); bounds.bound(ac3, ac3Bound); assertNotNull(solve(ac1.difference(ac2).union(ac3).some().and(ac1.acyclic()).and(ac2.acyclic()))); assertPrimVarNum(ac3Bound.size() + 10 + 6); bounds.bound(to3, factory.allOf(2)); bounds.bound(ord3, factory.setOf("0", "1", "2")); bounds.bound(first3, bounds.upperBound(ord3)); bounds.bound(last3, bounds.upperBound(ord3)); assertNotNull(solve(to3.product(ac1).some().and(ac1.acyclic()).and(to3.totalOrder(ord3, first3, last3)))); assertPrimVarNum(bounds.upperBound(ac1).size()); }
Example 3
Source File: ALG197.java From kodkod with MIT License | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-11, last formula of 14-15, and first formula of 16-22). * @return the bounds for the problem */ public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); final TupleSet op1l = f.setOf(f.tuple("e16", "e16", "e15")); // axiom 14, line 6 final TupleSet op2l = f.setOf(f.tuple("e26", "e26", "e25")); // axiom 15, line 6 op1h.removeAll(f.area(f.tuple("e16", "e16", "e10"), f.tuple("e16", "e16", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e26", "e26", "e20"), f.tuple("e26", "e26", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e15", "e26")); // first line of axioms 16-22 for(int i = 0; i < 7; i++) { Tuple t = f.tuple("e16", "e2"+i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 4
Source File: ALG195.java From kodkod with MIT License | 5 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-13, second formula of 14-15, and first formula of 16-22). * @return the bounds for the problem */ public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); for(int i = 0; i < 7; i++) { op1h.remove(f.tuple("e1"+i, "e1"+i, "e1"+i)); // axiom 12 op2h.remove(f.tuple("e2"+i, "e2"+i, "e2"+i)); // axiom 13 } final TupleSet op1l = f.setOf(f.tuple("e15", "e15", "e11")); // axiom 14, line 2 final TupleSet op2l = f.setOf(f.tuple("e25", "e25", "e21")); // axiom 15, line 2 op1h.removeAll(f.area(f.tuple("e15", "e15", "e10"), f.tuple("e15", "e15", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e25", "e25", "e20"), f.tuple("e25", "e25", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e14", "e26")); high.addAll(f.area(f.tuple("e16", "e20"), f.tuple("e16", "e26"))); // first line of axioms 16-22 for(int i = 0; i < 7; i++) { Tuple t = f.tuple("e15", "e2"+i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }
Example 5
Source File: SymmetryBreakingTest.java From kodkod with MIT License | 5 votes |
@Test public final void testAcyclic() { bounds.bound(ac1, factory.area(factory.tuple("0","0"), factory.tuple("4","4"))); assertNotNull(solve(ac1.some().and(ac1.acyclic()))); assertPrimVarNum(10); bounds.bound(r1, factory.range(factory.tuple("0"), factory.tuple("4"))); assertNotNull(solve(ac1.join(r1).some().and(ac1.acyclic()))); assertPrimVarNum(10 + bounds.upperBound(r1).size()); TupleSet ac2b = factory.setOf("5","6","7","8"); ac2b = ac2b.product(ac2b); bounds.bound(ac2, ac2b); assertNotNull(solve(ac1.difference(ac2).some().and(ac1.acyclic()).and(ac2.acyclic()))); assertPrimVarNum(10 + 6); bounds.boundExactly(r2, factory.setOf(factory.tuple("5", "6"))); assertNotNull(solve(ac2.join(r2).some().and(ac2.acyclic()))); final TupleSet ac3Bound = factory.allOf(2); ac3Bound.remove(factory.tuple("9", "9")); bounds.bound(ac3, ac3Bound); assertNotNull(solve(ac1.difference(ac2).union(ac3).some().and(ac1.acyclic()).and(ac2.acyclic()))); assertPrimVarNum(ac3Bound.size() + 10 + 6); bounds.bound(to3, factory.allOf(2)); bounds.bound(ord3, factory.setOf("0","1","2")); bounds.bound(first3, bounds.upperBound(ord3)); bounds.bound(last3, bounds.upperBound(ord3)); assertNotNull(solve(to3.product(ac1).some().and(ac1.acyclic()).and(to3.totalOrder(ord3,first3,last3)))); assertPrimVarNum(bounds.upperBound(ac1).size()); }
Example 6
Source File: ALG195.java From org.alloytools.alloy with Apache License 2.0 | 4 votes |
/** * Returns the bounds the problem (axioms 1, 4, 9-13, second formula of 14-15, * and first formula of 16-22). * * @return the bounds for the problem */ @Override public final Bounds bounds() { final Bounds b = super.bounds(); final TupleFactory f = b.universe().factory(); final TupleSet op1h = b.upperBound(op1).clone(); final TupleSet op2h = b.upperBound(op2).clone(); for (int i = 0; i < 7; i++) { op1h.remove(f.tuple("e1" + i, "e1" + i, "e1" + i)); // axiom 12 op2h.remove(f.tuple("e2" + i, "e2" + i, "e2" + i)); // axiom 13 } final TupleSet op1l = f.setOf(f.tuple("e15", "e15", "e11")); // axiom // 14, // line // 2 final TupleSet op2l = f.setOf(f.tuple("e25", "e25", "e21")); // axiom // 15, // line // 2 op1h.removeAll(f.area(f.tuple("e15", "e15", "e10"), f.tuple("e15", "e15", "e16"))); op1h.addAll(op1l); op2h.removeAll(f.area(f.tuple("e25", "e25", "e20"), f.tuple("e25", "e25", "e26"))); op2h.addAll(op2l); b.bound(op1, op1l, op1h); b.bound(op2, op2l, op2h); final TupleSet high = f.area(f.tuple("e10", "e20"), f.tuple("e14", "e26")); high.addAll(f.area(f.tuple("e16", "e20"), f.tuple("e16", "e26"))); // first line of axioms 16-22 for (int i = 0; i < 7; i++) { Tuple t = f.tuple("e15", "e2" + i); high.add(t); b.bound(h[i], f.setOf(t), high); high.remove(t); } return b; }