summaryrefslogtreecommitdiff
path: root/omega/examples/union
diff options
context:
space:
mode:
authordhuth <derickhuth@gmail.com>2014-11-21 13:35:20 -0700
committerdhuth <derickhuth@gmail.com>2014-11-21 13:35:20 -0700
commita1834b22c43c282442b0cb164767e6c877cf0e5b (patch)
treebedc5be7d1bdb8d32c1868caa496a8a1530d8d8a /omega/examples/union
parentded84bb4aec7461738e7b7033d782a518e2c606b (diff)
parenteb9236c5353785472ae132f27e1cfb9f1e4264a5 (diff)
downloadchill-a1834b22c43c282442b0cb164767e6c877cf0e5b.tar.gz
chill-a1834b22c43c282442b0cb164767e6c877cf0e5b.tar.bz2
chill-a1834b22c43c282442b0cb164767e6c877cf0e5b.zip
Merge branch 'master' into doe
Diffstat (limited to 'omega/examples/union')
-rw-r--r--omega/examples/union64
1 files changed, 64 insertions, 0 deletions
diff --git a/omega/examples/union b/omega/examples/union
new file mode 100644
index 0000000..d03fcba
--- /dev/null
+++ b/omega/examples/union
@@ -0,0 +1,64 @@
+# test ConvexRepresentation
+
+symbolic n;
+
+#
+# result is convex, same behavior as PairwiseCheck
+#
+r1:={[i,j]: 0<=i,j<=100};
+r2:={[i,j]: i>=100 && j>=0 && i+j<=200};
+r3:={[i,j]: i>=0 && j>=100 && i+j<=200};
+PairwiseCheck (r1 union r2 union r3);
+ConvexRepresentation (r1 union r2 union r3);
+
+r1:={[i]: 1<=i<=n && exists (alpha: i=2alpha)};
+r2:={[i]: 1<=i<=n && exists (alpha: i=2alpha+1)};
+PairwiseCheck (r1 union r2);
+ConvexRepresentation (r1 union r2);
+
+#
+# test neighboring regions merge
+#
+r1:={[i]: 1<=i<=9 && exists (alpha: i=2alpha+1)};
+r2:={[i]: 9<=i<=99 && exists (alpha: i=2alpha+1)};
+PairwiseCheck (r1 union r2);
+ConvexRepresentation (r1 union r2);
+
+r1:={[i,j]:1<=i,j<=100};
+r2:={[i,j]:50<=i<=100 && 100<=j<=200};
+r3:={[i,j]:1<=i<=50 && 100<=j<=200};
+r4:={[i,j]: 1000<=i,j<=2000};
+PairwiseCheck (r1 union r2 union r3 union r4);
+ConvexRepresentation (r1 union r2 union r3 union r4);
+
+#
+# test stride condition merge, filling up holes
+#
+r1:={[i]:1<=i<=100 && exists (alpha: 1+7alpha<=i<=3+7alpha)};
+r2:={[i]:1<=i<=100 && exists (alpha: i=4+7alpha)};
+r3:={[i]:1<=i<=100 && exists (alpha: i=5+7alpha)};
+r4:={[i]:1<=i<=100 && exists (alpha: 6+7alpha<=i<=9+7alpha)};
+PairwiseCheck (r1 union r2 union r3);
+ConvexRepresentation (r1 union r2 union r3);
+
+PairwiseCheck (r1 union r2 union r4);
+ConvexRepresentation (r1 union r2 union r4);
+
+r1:={[i]:6<=i<=96 && exists (alpha: i=6alpha)};
+r2:={[i]:3<=i<=93 && exists (alpha: i=3+6alpha)};
+PairwiseCheck (r1 union r2);
+ConvexRepresentation (r1 union r2);
+
+r1:={[i]:1<=i<=100 && exists (alpha: 1+15alpha<=i<=4+15alpha)};
+r2:={[i]:1<=i<=100 && exists (alpha: 6+15alpha<=i<=8+15alpha)};
+r3:={[i]:1<=i<=100 && exists (alpha: 11+15alpha<=i<=13+15alpha)};
+PairwiseCheck (r1 union r2 union r3);
+ConvexRepresentation (r1 union r2 union r3);
+
+#
+# additional test cases
+#
+r1:={[i]:0<=i<=100};
+r2:={[i]: 10<=i<=100 && exists (alpha: i=1+5alpha)};
+PairwiseCheck (r1 union r2);
+ConvexRepresentation (r1 union r2);