Type.Int));
}
// Range Check
for (int i = 0; i < total; i++) {
String var = MessageFormat.format(varPattern, i);
result.add(new Assert(new Predicate(Operator.AND, new Predicate(
Operator.GE, new Variable(var), new Constant(1)),
new Predicate(Operator.LE, new Variable(var), new Constant(
size * size)))));
}
// Assigned values
for (int[] assign : assigned) {
String var = MessageFormat.format(varPattern,
translate(assign[0], assign[1]));
result.add(new Assert(new Predicate(Operator.EQUAL, new Variable(
var), new Constant(assign[2]))));
}
// Limitations
// Columns and rows
for (int i = 0; i < size * size; i++) {
for (int j = 0; j < size * size; j++) {
for (int k = j + 1; k < size * size; k++) {
result.add(new Assert(new Predicate(Operator.NOT,
new Predicate(Operator.EQUAL, new Variable(
MessageFormat.format(varPattern,
translate(i, j))), new Variable(
MessageFormat.format(varPattern,
translate(i, k)))))));
result.add(new Assert(new Predicate(Operator.NOT,
new Predicate(Operator.EQUAL, new Variable(
MessageFormat.format(varPattern,
translate(j, i))), new Variable(
MessageFormat.format(varPattern,
translate(k, i)))))));
result.add(new Assert(new Predicate(Operator.NOT,
new Predicate(Operator.EQUAL, new Variable(
MessageFormat.format(varPattern,
sqrtranslate(i, j))), new Variable(
MessageFormat.format(varPattern,
sqrtranslate(i, k)))))));
}