use of kodkod.instance.Universe in project org.alloytools.alloy by AlloyTools.
the class Netconfig method bounds.
/**
* Returns a bounds object that constructs the 'scope' for analyzing the
* commands, using the given values for the number of sites, routers, and the
* length of time.
*
* @requires all arguments are positive and hqNum <= siteNum
* @return a bounds for the model
*/
public Bounds bounds(int siteNum, int hqNum, int routerNum, int timeLength) {
assert siteNum > 0 && hqNum > 0 && hqNum <= siteNum && routerNum > 0 && timeLength > 0;
final List<String> atoms = new ArrayList<String>(siteNum + routerNum + timeLength);
for (int i = 0; i < siteNum; i++) {
atoms.add("Site" + i);
}
for (int i = 0; i < routerNum; i++) {
atoms.add("Router" + i);
}
for (int i = 0; i < timeLength; i++) {
atoms.add("Time" + i);
}
final Universe u = new Universe(atoms);
final TupleFactory f = u.factory();
final Bounds b = new Bounds(u);
final String site0 = "Site0";
final String siteN = "Site" + (siteNum - 1);
final TupleSet sBound = f.range(f.tuple(site0), f.tuple(siteN));
b.boundExactly(Site, sBound);
b.boundExactly(HQ, f.range(f.tuple(site0), f.tuple("Site" + (hqNum - 1))));
if (hqNum < siteNum) {
b.boundExactly(Sub, f.range(f.tuple("Site" + hqNum), f.tuple(siteN)));
} else {
b.bound(Sub, f.noneOf(1));
}
final TupleSet tBound = f.range(f.tuple("Time0"), f.tuple("Time" + (timeLength - 1)));
b.bound(Time, tBound);
b.bound(start, tBound);
b.bound(end, tBound);
b.bound(tick, tBound.product(tBound));
final TupleSet rBound = f.range(f.tuple("Router0"), f.tuple("Router" + (routerNum - 1)));
b.boundExactly(Router, rBound);
// b.bound(site, rBound.product(sBound));
b.bound(satellite, rBound.product(rBound).product(tBound));
b.bound(lineOfSight, b.upperBound(satellite));
assert siteNum == routerNum;
final TupleSet siteBound = f.noneOf(2);
for (int i = 0; i < siteNum; i++) siteBound.add(f.tuple("Router" + i, "Site" + i));
// rBound.product(sBound));
b.boundExactly(site, siteBound);
return b;
}
use of kodkod.instance.Universe in project org.alloytools.alloy by AlloyTools.
the class ALG195_1 method bounds.
/**
* Returns the partial bounds the problem (axioms 1, 4, 9-11).
*
* @return the partial bounds for the problem
*/
public Bounds bounds() {
final List<String> atoms = new ArrayList<String>(14);
for (int i = 0; i < 7; i++) atoms.add("e1" + i);
for (int i = 0; i < 7; i++) atoms.add("e2" + i);
final Universe u = new Universe(atoms);
final Bounds b = new Bounds(u);
final TupleFactory f = u.factory();
final TupleSet s1bound = f.range(f.tuple("e10"), f.tuple("e16"));
final TupleSet s2bound = f.range(f.tuple("e20"), f.tuple("e26"));
b.boundExactly(s1, s1bound);
b.boundExactly(s2, s2bound);
// axioms 9, 10, 11
for (int i = 0; i < 7; i++) {
b.boundExactly(e1[i], f.setOf("e1" + i));
b.boundExactly(e2[i], f.setOf("e2" + i));
}
// axom 1
b.bound(op1, f.area(f.tuple("e10", "e10", "e10"), f.tuple("e16", "e16", "e16")));
// axiom 4
b.bound(op2, f.area(f.tuple("e20", "e20", "e20"), f.tuple("e26", "e26", "e26")));
final TupleSet hbound = s1bound.product(s2bound);
for (Relation r : h) {
b.bound(r, hbound);
}
return b;
}
use of kodkod.instance.Universe in project org.alloytools.alloy by AlloyTools.
the class ALG212 method bounds.
/**
* Returns the bounds for the given scope.
*
* @return bounds for the given scope
*/
public final Bounds bounds(int n) {
assert n > 0;
final List<String> atoms = new ArrayList<String>(n);
for (int i = 0; i < n; i++) atoms.add("a" + i);
final Universe u = new Universe(atoms);
final Bounds b = new Bounds(u);
b.bound(f, u.factory().allOf(4));
return b;
}
use of kodkod.instance.Universe in project org.alloytools.alloy by AlloyTools.
the class COM008 method bounds.
/**
* Returns bounds for the given scope.
*
* @return bounds for the given scope.
*/
public final Bounds bounds(int n) {
assert n > 0;
final List<String> atoms = new ArrayList<String>(n);
atoms.add("goal");
for (int i = 0; i < n; i++) atoms.add("a" + i);
final Universe u = new Universe(atoms);
final Bounds bound = new Bounds(u);
final TupleFactory f = u.factory();
final TupleSet d1 = f.range(f.tuple("a0"), f.tuple("a" + (n - 1)));
final TupleSet d2 = d1.product(d1);
bound.bound(rewrite, d2);
bound.bound(equalish, d2);
bound.bound(a, d1);
bound.bound(b, d1);
bound.bound(c, d1);
bound.boundExactly(Atom, d1);
bound.bound(trr, d2);
bound.bound(goal, f.setOf("goal"));
return bound;
}
use of kodkod.instance.Universe in project org.alloytools.alloy by AlloyTools.
the class MED001 method bounds.
/**
* Returns bounds for the given scope.
*
* @return bounds for the given scope.
*/
public final Bounds bounds(int n) {
assert n > 0;
final List<String> atoms = new ArrayList<String>(n);
for (int i = 0; i < n; i++) atoms.add("a" + i);
final Universe u = new Universe(atoms);
final Bounds b = new Bounds(u);
final TupleFactory f = u.factory();
final TupleSet s = f.allOf(1);
b.bound(bcapacityne, s);
b.bound(bcapacityex, s);
b.bound(bcapacitysn, s);
b.bound(conditionhyper, s);
b.bound(conditionhypo, s);
b.bound(conditionnormo, s);
b.bound(drugi, s);
b.bound(uptakelg, s);
b.bound(uptakepg, s);
b.bound(releaselg, s);
b.bound(bsecretioni, s);
b.bound(drugbg, s);
b.bound(qilt27, s);
b.bound(s0, s);
b.bound(s1, s);
b.bound(s2, s);
b.bound(s3, s);
b.bound(drugsu, s);
b.bound(n0, s);
b.bound(gt, f.allOf(2));
return b;
}
Aggregations