Go to the previous, next section.

Constraint Math

Assume a, b and c are of the class constraint; x, i and j are integers and o is a boolean.

x = a[i];
a[i] = y;
Read and modify the i-th element of the constraint a. The first element is the constant. The subsequent elements are coefficients.

o = (a == b);
Are rows a and b are identical? (!= is also available)

c = a + b;
Add the corresponding elements of the two constraints a and b, and put the results in c.

c = a - b;
Subtract the corresponding elements of the two constraints a and b, and put the results in c.

c = a * b;
Multiply the corresponding elements of a and b, and put the results in c.

c += a;
Add the corresponding elements of a to the row c.

c -= a;
Subtract the corresponding elements of a from the row c.

c *= a;
Multiply the elements of c by the corresponding elements of a.

c = a + x;
Add the integer x to each element of a, and put the results in c.

c = a - x;
Subtract the integer x form each element of a, and put the results in the row c.

c = a * x;
Multiply each element of a by the integer x, and put the results in the row c.

c = a / x;
Divide each element of a by the integer x, and put the results in the row c.

c += x;
Add the integer x to each element of c.

c -= x;
Subtract the integer x from each element of c.

c *= x;
Multiply each element of a by the integer x.

c /= x;
Divide each element of a by the integer x.

a = b.complement();
a = -b;
Complement the constraint. The complement of the constraint A >= 0 is A < 0.

i = a.row_lcm();
Find the largest common multiplier of all the elements of the constraint.

i = a.row_gcd();
Find the greatest common divisor of all the elements of the constraint.

i = a.rank()
Return the position of the highest column with a non-zero value.

i = a.unique()
Only one non-zero variable (a[0] is the constant).

i = a.highest_order(b);
Return an integer val s.t. for all locations x of a, if a[x]!=0 then val += b[c].


Go to the previous, next section.