Re: [eclipse-clp-users] findall + gfd strange behaviuor

From: Joachim Schimpf <jschimpf_at_coninfer.com>
Date: Thu, 02 Jan 2014 15:17:11 +0000
On 30/12/2013 20:57, Sergii Dymchenko wrote:
> Hi,
> 
> Consider this:
> 
> main :-
>     (for(N, 4, 6), fromto(0, Sprev, Scurr, S) do
>         findall(X, (model(N, X, Digits), find(X, Digits)), Sols),
>         eclipse_language:sum(Sols, Si),
>         Scurr is Sprev + Si),
>     writeln(S).
> 
> My understanding that this is equivalent to the case when model/3 is called outside of findall,
> because findall undoes all changes:
> 
> main :-
>     (for(N, 4, 6), fromto(0, Sprev, Scurr, S) do
>         model(N, X, Digits),
>         findall(X, find(X, Digits), Sols),
>         eclipse_language:sum(Sols, Si),
>         Scurr is Sprev + Si),
>     writeln(S).
> 
> And these two mains give the same results when I use lib(ic) for my models. But results are
> different when I use lib(gfd).
> 
> Could it be a bug in lib(gfd) or I missed something? My current ECLiPSe version is 6.1 #174
> (x86_64_linux).
> 
> I've attached the whole program.


Hi Sergii,

You should of course get the same results, it seems to be a bug in lib(gfd).
What happens is that find/2 wrongly returns duplicate solutions, probably
because it searches the conjunction of model(4,...),model(5,...) etc.
Kish, the author of gfd will look into it once he's back from holiday.


Happy New Year!

-- Joachim
Received on Thu Jan 02 2014 - 15:16:30 CET

This archive was generated by hypermail 2.2.0 : Mon Jan 20 2014 - 06:13:30 CET