Ulrich Scholz wrote: > Hi, > > I'd like to write a demon that wakes when an ic variable gets constrained. > Also, it should wake if the ic variable is made equal to another ic variable > with same bounds. > > Somehow, I seem to set up the condition list it in a wrong way. Consider > the three examples given below. Only t2 weakes the demon. How can I set up > a demon that wakes in case t3? > > Thanks, > > Ulrich > > > I'm using ECLiPSe Version 6.0 #154 (i386_linux) > > ---- > :- lib(ic). > > :- demon d/0. > > d :- > writeln("suspension woken"). > > t1 :- > suspend(d, 0, [X->bound], _S), > > X = Y. > > t2 :- > X :: [0..100], > > suspend(d, 0, [X->bound, X->constrained], _S), > > Y :: [0..50], > > X = Y. > > t3 :- > X :: [0..100], > > suspend(d, 0, [X->bound, X->constrained], _S), > > Y :: [0..100], > > X = Y. Unification of X with an "unrelated" Y will not cause waking. You have to include Y in the trigger condition like this: t4 :- X :: [0..100], suspend(d, 0, [[X,Y]->bound], _S), Y :: [0..100], X = Y. See http://eclipseclp.org/doc/userman/umsroot111.html#toc130 -- JoachimReceived on Mon Apr 04 2011 - 00:20:09 CEST
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET