An easy way to avoid rounding errors, is to multiply up the fractions. In the case of the 3-fractions puzzle, this gives:
A(EF)(HI)+D(BC)(HI)+G(BC)(EF) == (BC)(EF)(HI)Given the repetition of the original denominators, it is now useful to bind each of these to an auxiliary variable for greater propagation.
When n is less than or equal to 3, an all-different constraint can be used on the digit variables. Otherwise, an occurrence constraint is used to ensure that each digit appears the correct number of times.
A D G -- <= -- <= -- BC EF HIIt is also possible to view the fractions arranged in a matrix model. Again using the 3-fractions puzzle as an example:
/A D G\ |B E H| \C F I/This matrix has column symmetry only, hence all symmetry can be broken by lexicographically ordering the columns [1]. Due to the structure of the problem, different results are obtained by changing the order in which the column vectors are built. For example, instead of reading the elements top to bottom, producing <A, B, C>, <D, E, F> and <G, H, I>, the elements can be read <C, B, A>, <F, E, D> and <I, H, G>. Depending on the choice of symmetry-breaking constraints, a variety of implied constraints follow, as discussed in [2] below.