use of kodkod.util.ints.ArrayIntVector in project org.alloytools.alloy by AlloyTools.
the class BenchmarkSymmStats method toNauty.
private static void toNauty(Bounds bounds, PrintStream stream) {
int size = bounds.universe().size() + bounds.ints().size();
for (Relation r : bounds.relations()) {
final int upsize = bounds.upperBound(r).size(), lowsize = bounds.lowerBound(r).size();
size += (upsize == lowsize ? upsize : upsize + lowsize) * r.arity();
}
stream.println("n=" + size + " $0 *=13 k = 0 " + size + " +d -a -m g");
int v = bounds.universe().size();
final IntVector vec = new ArrayIntVector();
vec.add(v);
for (Relation r : bounds.relations()) {
final int arity = r.arity();
final TupleSet up = bounds.upperBound(r), down = bounds.lowerBound(r);
final TupleSet[] sets = up.size() == down.size() || down.size() == 0 ? new TupleSet[] { up } : new TupleSet[] { down, up };
for (TupleSet s : sets) {
for (Tuple t : s) {
for (int i = 0, max = arity - 1; i < max; i++) {
stream.println(v + " : " + (v + 1) + " " + t.atomIndex(i) + ";");
v++;
}
stream.println(v + " : " + t.atomIndex(arity - 1) + ";");
v++;
}
vec.add(v);
}
}
for (TupleSet s : bounds.intBounds().values()) {
stream.println(v + " : " + s.iterator().next().atomIndex(0) + ";");
v++;
vec.add(v);
}
// stream.println(".");
stream.print("f = [ 0:" + (vec.get(0) - 1));
for (int i = 1; i < vec.size(); i++) {
stream.print(" | " + vec.get(i - 1) + ":" + (vec.get(i) - 1));
}
stream.println(" ]");
stream.println("x");
// stream.println("o");
stream.println("q");
}
use of kodkod.util.ints.ArrayIntVector in project org.alloytools.alloy by AlloyTools.
the class BenchmarkSymmStats2 method toNauty.
private static void toNauty(Bounds bounds, PrintStream stream) {
int size = bounds.universe().size() + bounds.ints().size();
for (Relation r : bounds.relations()) {
final int upsize = bounds.upperBound(r).size(), lowsize = bounds.lowerBound(r).size();
size += (upsize == lowsize ? upsize : upsize + lowsize) * r.arity();
}
stream.println("n=" + size + " $0 *=13 k = 0 " + size + " +d -a g");
int v = bounds.universe().size();
final IntVector vec = new ArrayIntVector();
vec.add(v);
for (Relation r : bounds.relations()) {
final int arity = r.arity();
final TupleSet up = bounds.upperBound(r), down = bounds.lowerBound(r);
final TupleSet[] sets = up.size() == down.size() || down.size() == 0 ? new TupleSet[] { up } : new TupleSet[] { down, up };
for (TupleSet s : sets) {
for (Tuple t : s) {
for (int i = 0, max = arity - 1; i < max; i++) {
stream.println(v + " : " + (v + 1) + " " + t.atomIndex(i) + ";");
v++;
}
stream.println(v + " : " + t.atomIndex(arity - 1) + ";");
v++;
}
vec.add(v);
}
}
for (TupleSet s : bounds.intBounds().values()) {
stream.println(v + " : " + s.iterator().next().atomIndex(0) + ";");
v++;
vec.add(v);
}
// stream.println(".");
stream.print("f = [ 0:" + (vec.get(0) - 1));
for (int i = 1; i < vec.size(); i++) {
stream.print(" | " + vec.get(i - 1) + ":" + (vec.get(i) - 1));
}
stream.println(" ]");
stream.println("x");
stream.println("o");
stream.println("q");
}
Aggregations