use of kodkod.ast.IntExpression in project org.alloytools.alloy by AlloyTools.
the class IntTest method nonConstants.
private IntExpression[] nonConstants() {
final Options options = solver.options();
final IntRange range = options.integers();
final int min = range.min(), max = range.max();
final int size = range.size();
final Relation[] r = new Relation[size];
final TupleFactory f = bounds.universe().factory();
for (int i = 0; i < size; i++) {
int arity = i % 3 + 1;
r[i] = Relation.nary("r" + i, arity);
TupleSet b = f.noneOf(arity);
for (int j = (i / 3) * ((int) Math.pow(SIZE, arity - 1)), jmax = j + size; j < jmax; j++) {
b.add(f.tuple(arity, j % b.capacity()));
}
bounds.bound(r[i], b);
}
final IntExpression[] vals = new IntExpression[max - min + 1];
for (int i = 0; i < size; i++) {
vals[i] = i + min < 0 ? r[i].count().negate() : r[i].count();
}
return vals;
}
use of kodkod.ast.IntExpression in project org.alloytools.alloy by AlloyTools.
the class IntTest method constants.
private IntExpression[] constants() {
final Options options = solver.options();
final IntRange range = options.integers();
final int min = range.min(), max = range.max();
final IntExpression[] vals = new IntExpression[max - min + 1];
for (int i = min; i <= max; i++) {
vals[i - min] = constant(i);
}
return vals;
}
Aggregations