« Return to Thread: CHR output doesn't reflect propagation rule

Re: Re: CHR output doesn't reflect propagation rule

by Jean-Marc Vanel-2 :: Rate this Message:

Reply to Author | View in Thread


2008/5/14 Tom Schrijvers <Tom.Schrijvers@...>:

As far as I can tell, it does work. In your above queries there are no constraints to be found, so find_chr_constraint/1 fails.
Try this:

       ?- leq(X,Y), find_chr_constraint(C).
       leq(_G30038, _G30039)
       C = leq(X, Y),
       put_attr(Y, user, [suspension(53, active, _G30344, 0, user:leq___2__0(X, Y, **), leq, X, Y)]),
       put_attr(X, user, [suspension(53, active, _G30344, 0, user:leq___2__0(X, Y, **), leq, X, Y)]) .

Tom

Shame on me, I didn't try this. I probably had the wrong idea that the constraint store is persistant.

Moreover, if one types this before, it removes the first line leq(_G30038, _G30039) :
set_prolog_flag( chr_toplevel_show_store, true ).

But how can I remove the 2 lines with put_attr(...) ?


Other insatisfactions:

1. If I try to make a printing loop this way, I loose the "real" variable names :

leq(X,Y), ( find_chr_constraint( CC), writeln( CC ), fail ; true ).
leq(_G14710, _G14711)
put_attr(Y, leq, [suspension(2289, active, t, 0, leq:leq___2__0(X, Y, **), leq, X, Y)]),
put_attr(X, leq, [suspension(2289, active, t, 0, leq:leq___2__0(X, Y, **), leq, X, Y)]) .

2. The same thing happens when I get the results as a list:

leq(A,B), setof( CC, find_chr_constraint( CC), List ).
List = [leq(_G15335, _G15336)],
put_attr(B, leq, [suspension(2291, active, t, 0, leq:leq___2__0(A, B, **), leq, A, B)]),
.......


--
Jean-Marc Vanel
http://jmvanel.free.fr/

 « Return to Thread: CHR output doesn't reflect propagation rule