Next: , Up: CLPFD Example Programs   [Contents][Index]


10.10.12.1 Send More Money

Let us return briefly to the Send More Money problem (see Constraint Satisfaction Problems). Its sum/8 predicate will expand to a scalar_product/4 constraint. An indexical version is defined simply by changing the neck symbol of sum/8 from ‘:-’ to ‘+:’, thus turning it into an FD predicate:

sum(S, E, N, D, M, O, R, Y) +:
                  1000*S + 100*E + 10*N + D 
     +            1000*M + 100*O + 10*R + E
     #= 10000*M + 1000*O + 100*N + 10*E + Y.

Send feedback on this subject.