Re: [eclipse-clp-users] Bug in lex_lt with occurrences?

From: Kish Shen <kisshen_at_...5...>
Date: Fri, 25 Jan 2013 18:52:15 +0000
Hi Sergii,

Thanks for reporting this. It looks to be a bug in ic_global's lex_lt/2 
(i.e. not because of incorrect interaction with occurrences/3), as a 
constraint X #> Y should be posted for the last elements of lex_lt(Xs, 
Ys) [if Xs and Ys are the same length].

I'll check the fix in, but we are currently having some problems with 
the x86_64_linux machine we are using for our build. Hopefully the 
problem will be resolved in a couple of days.

Thanks again,

Kish

On 23/01/2013 02:14, Sergii Dymchenko wrote:
> Hi!
>
> I think I've encountered a nasty bug in ic_global.
>
> Version 6.0 #199 (x86_64_linux), Fri Nov  2 22:47 2012
>
> :- lib(ic).
> :- lib(ic_global).
> :- lib(ic_global_gac).
>
> model_1(Curr, Next) :-
>      length(Curr, N), length(Next, N),
>      Next :: 0..9,
>      ( for(I, 1, 9), param(Curr, Next) do
>          occurrences(I, Curr, Di),
>          occurrences(I, Next, Di) ),
>      ic_global:lex_lt(Curr, Next),
>      labeling(Next).
>
> model_2(Curr, Next) :-
>      length(Curr, N), length(Next, N),
>      Next :: 0..9,
>      ( for(I, 1, 9), param(Curr, Next) do
>          occurrences(I, Curr, Di),
>          occurrences(I, Next, Di) ),
>      ic_global_gac:lex_lt(Curr, Next),
>      labeling(Next).
>
> model_3(Curr, Next) :-
>      length(Curr, N), length(Next, N),
>      Next :: 0..9,
>      same(Curr, Next),
>      ic_global:lex_lt(Curr, Next),
>      labeling(Next).
>
> model_4(Curr, Next) :-
>      length(Curr, N), length(Next, N),
>      Next :: 0..9,
>      same(Curr, Next),
>      ic_global_gac:lex_lt(Curr, Next),
>      labeling(Next).
>
>
> Model description:
> Curr is a list of digits.
> I want Next to be a list of the same length as Curr, with the same
> number of non-zero digit, and Curr is lexicography smaller than Next.
> Another formulation of the same model: Next is a permutation of Curr,
> and Curr is lexicography smaller than Next.
>
> I prepared 4 models:
> 1: ic_global:occurrences and ic_global:lex_lt
> 2: ic_global:occurrences and ic_global_gac:lex_lt
> 3: ic_global_gac:same and ic_global:lex_lt
> 4: ic_global_gac:same and ic_global_gac:lex_lt
>
> I think all 4 models are equivalent.
>
> But model_1 works only for some cases:
>
> :- model_1([0, 5, 9, 4, 9, 1, 9], X).
> X = [0, 5, 9, 4, 9, 9, 1]
>
> :- model_1([0, 5, 9, 7, 7, 3, 3], X).
> X = [0, 7, 3, 3, 5, 7, 9]
>
> But for many other cases I get exactly the same list from model_1
> despite lex_lt constraint:
>
> :- model_1([0, 5, 9, 7, 7, 3, 2], X).
> X = [0, 5, 9, 7, 7, 3, 2]
>
> :- model_1([0, 4, 9, 7, 6, 3, 3], X).
> X = [0, 4, 9, 7, 6, 3, 3]
>
> So I think there is a bug in ECLiPSe when both ic_global:occurrences
> and ic_global:lex_lt are used.
>
> Sergey.
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
Received on Fri Jan 25 2013 - 19:27:23 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST