[Next] [Up] [Previous] [Contents] [Index]
Next: Interval-consistency Up: Propagators for binary constraints Previous: Propagators for binary constraints   Contents   Index

Forward checking

The following shows a propagator that performs forward checking for the binary constraint.
    'aX=bY+c'(A,X,B,Y,C) =>
          'aX=bY+c_forward'(A,X,B,Y,C).

    'aX=bY+c_forward'(A,X,B,Y,C),var(X),var(Y),{ins(X),ins(Y)} => true.
    'aX=bY+c_forward'(A,X,B,Y,C),var(X) => 
           T is B*Y+C, Ex is T//A, (A*Ex=:=T->X = Ex; true).
    'aX=bY+c_forward'(A,X,B,Y,C) => 
           T is A*X-C, Ey is T//B, (B*Ey=:=T->Y is Ey;true).
When both X and Y are variables, the propagator is suspended. When either variable is instantiated, the propagator computes the value for the other variable.



Neng-Fa Zhou () 2007-06-05