ge(X, Y) :- % woken on change of bounds
var_range(X, _, XH),
var_range(Y, YL, _),
( var(X),var(Y) ->
suspend(ge(X,Y), 3, [X->wake_hi, Y->wake_lo])
;
true),
lwb(X, YL), upb(Y, XH), % impose new bounds
wake. % execute woken goals here
The constraint wakes when either the upper bound of X or the lower bound of
Y changes, and imposes the consequences onto the other variable.
When lwb/2 and upb/2 cause further bound changes, that may wake other goals
(ie. they have the effect of schedule_suspensions/2)
and we therefore have to
invoke the waking scheduler wake/0 afterwards.