Re: Question regarding REPAIR

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Wed 19 Jan 2005 02:40:13 PM GMT
Message-ID: <41EE714D.70805@icparc.ic.ac.uk>
Ulrich Scholz wrote:
> Hi everybody.
> 
> Recently, I've started to look into the repair library and, of course,
> I have some questions.  More specifically, I experimented with
> tent_call/3 and wonder whether it is possible to have access to the
> old tentative assignment.  But let me explain step by step:
> 
> 1) Lets assume the following lines of code:
> 
> :- lib(repair).
> :- lib(ic).
> 
> test :-
>     [X,Y,Z] :: [1..inf],
>     X tent_set 4,
>     Y tent_set 3,
>     Z tent_set 4,
>     tent_call(X, Y, minlist([X,3],Y)),
>     tent_call(Y, Z, minlist([Y,2],Z)),
>     X tent_set 5.
> 
> Question: Does the final change of the tentative value of X wake the
> second constraint?  I would hope not, as the tentative value of Y is
> not changed.
> 

That's right, the second constraint is not woken.
(you can use the tracer and jump to resume-ports to see that)


> 
> 2) Now, let's change this code a little bit.
> 
> :- lib(repair).
> :- lib(ic).
> 
> test :-
>     [X,Y,Z] :: [1..inf],
>     X tent_set 4,
>     Y tent_set 3,
>     Z tent_set 4,
>     tent_call(X, Y, my_minlist([X,3],Y)),
>     tent_call(Y, Z, my_minlist([Y,2],Z)),
>     X tent_set 5.
> 
> my_minlist(List, Min) :-
>     minlist(List, Min).
> 
> 
> Question: Now, I guess, the second constraint is woken.  Am I right?

No, it behaves exactly as before, why should it be different?


> Although the minimum does not change, the tentative value of Y gets
> assigned

No, what makes you think so?


  > - except if tent_call/3 compares the old tentative assignment
> of Y with the new one.
> 

It does indeed.


> 
> 3) To prevent this (and for other uses, too), I would like to have
>     access to the old tentative assignment of Min in my_minlist.  Is
>     that possible?

You will have to program it yourself (following the pattern in the
Constraint Library Manual, section "Waking on Tentative Assignment Change")
and adding an extra argument for the old tentative value.


-- 
   Joachim Schimpf              /             phone: +44 20 7594 8187
   IC-Parc                     /      mailto:J.Schimpf@imperial.ac.uk
   Imperial College London    /    http://www.icparc.ic.ac.uk/eclipse
Received on Wed Jan 19 14:42:52 2005

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:33 PM GMT GMT