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.Received on Wed Jan 23 2013 - 02:14:14 CET
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST