You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
(29) |
Dec
(21) |
2007 |
Jan
(48) |
Feb
(9) |
Mar
(49) |
Apr
(49) |
May
(33) |
Jun
(28) |
Jul
(34) |
Aug
(51) |
Sep
(52) |
Oct
(26) |
Nov
(15) |
Dec
(26) |
2008 |
Jan
(21) |
Feb
(22) |
Mar
(19) |
Apr
(35) |
May
(23) |
Jun
(62) |
Jul
(11) |
Aug
(20) |
Sep
(35) |
Oct
(46) |
Nov
(22) |
Dec
(3) |
2009 |
Jan
(45) |
Feb
(59) |
Mar
(24) |
Apr
(19) |
May
(10) |
Jun
(17) |
Jul
(16) |
Aug
(30) |
Sep
(41) |
Oct
(55) |
Nov
(37) |
Dec
(18) |
2010 |
Jan
(13) |
Feb
(103) |
Mar
(64) |
Apr
(134) |
May
(35) |
Jun
(47) |
Jul
(31) |
Aug
(27) |
Sep
(29) |
Oct
(6) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(20) |
Feb
(6) |
Mar
(8) |
Apr
(19) |
May
(36) |
Jun
(23) |
Jul
(10) |
Aug
(14) |
Sep
(54) |
Oct
(15) |
Nov
(29) |
Dec
(19) |
2012 |
Jan
(20) |
Feb
(11) |
Mar
(21) |
Apr
(7) |
May
(17) |
Jun
(3) |
Jul
(9) |
Aug
(10) |
Sep
(19) |
Oct
(46) |
Nov
(22) |
Dec
(3) |
2013 |
Jan
(6) |
Feb
(27) |
Mar
(9) |
Apr
(13) |
May
(9) |
Jun
(18) |
Jul
(33) |
Aug
(32) |
Sep
(10) |
Oct
(16) |
Nov
(3) |
Dec
(16) |
2014 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(3) |
May
(5) |
Jun
(4) |
Jul
(1) |
Aug
(13) |
Sep
(9) |
Oct
(5) |
Nov
(12) |
Dec
(39) |
2015 |
Jan
(14) |
Feb
(15) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(12) |
Jul
(6) |
Aug
|
Sep
(1) |
Oct
(15) |
Nov
(6) |
Dec
(5) |
2016 |
Jan
|
Feb
(11) |
Mar
(17) |
Apr
|
May
(1) |
Jun
(6) |
Jul
(3) |
Aug
(1) |
Sep
(9) |
Oct
|
Nov
(7) |
Dec
|
2017 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(6) |
Jul
|
Aug
(3) |
Sep
(6) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2018 |
Jan
(1) |
Feb
(8) |
Mar
|
Apr
(5) |
May
(4) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2019 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(1) |
Nov
(1) |
Dec
(5) |
2020 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
(6) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
(4) |
May
|
Jun
(13) |
Jul
(10) |
Aug
(4) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(1) |
2022 |
Jan
(1) |
Feb
(4) |
Mar
(1) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
(5) |
2023 |
Jan
|
Feb
(6) |
Mar
(11) |
Apr
(3) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2024 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(3) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2025 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paulo M. <pm...@lo...> - 2023-05-30 13:11:50
|
Hi, Logtalk 3.66.0 is now available for downloading at: https://logtalk.org/ This release adds new keys to the "logtalk_load_context/2" built-in predicate for use with the term-expansion mechanism; adds two new meta-messages to the message printing mechanism to support user-defined printing goals; adds new linter warnings for DCGs, lambda expressions, predicate directives and backends without a module system; improves reporting of warnings when compiling auxiliary predicates; improves the Handbook and the documentation of several libraries and tools; adds a new "ulid" library for generating Universally Unique Lexicographically Sortable Identifiers; provides improvements and fixes to several tools, libraries examples, and contributions; adds additional compliance tests for Prolog standard predicates; fixes a registry issue when running the Windows installer; and provides portability updates for LVM, Quintus Prolog, Scryer Prolog, and, Trealla Prolog. For details and a complete list of changes, please consult the release notes at: https://github.com/LogtalkDotOrg/logtalk3/blob/master/RELEASE_NOTES.md You can show your support for Logtalk continued development and success at GitHub by giving us a star and a symbolic sponsorship: https://github.com/LogtalkDotOrg/logtalk3 Happy logtalking! Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer |
From: Paulo M. <pm...@lo...> - 2023-04-27 15:17:50
|
Hi, Logtalk 3.65.0 is now available for downloading at: https://logtalk.org/ This release documents the no longer experimental "(@)/1" control construct; adds a new "since" key to the "info/2" directive; adds two new values for the number of proofs to the "mode/2" directive; improves the Handbook sections on debugging and documenting predicates; reduces the number of atoms created by some tools and libraries; fixes the "git" library when working with paths containing spaces; includes significant fixes and improvements to the "debugger" and "lgtunit" tools; improves tests reporting; includes fixes for the Java examples and testing automation on Windows; adds notes for most of the skipped tests; includes new and revised tests; and provides portability updates for LVM, Scryer Prolog, and, Trealla Prolog. For details and a complete list of changes, please consult the release notes at: https://github.com/LogtalkDotOrg/logtalk3/blob/master/RELEASE_NOTES.md You can show your support for Logtalk continued development and success at GitHub by giving us a star and a symbolic sponsorship: https://github.com/LogtalkDotOrg/logtalk3 Happy logtalking! Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer |
From: Joachim S. <jsc...@co...> - 2023-04-07 10:19:16
|
On 06/04/2023 09:55, Panagiotis Stamatopoulos wrote: > Hello All, > > Is there any possibility for the same program to be more efficient > when it uses ic:alldifferent/1 than its counterpart that exploits > ic_global:alldifferent/1? It seems quite strange to me and I wonder > if I am doing something wrong. Yes, this is possible, and even quite common. The reason is that there is a trade-off between the potential strength of propagation, and the effort with which this can be achieved. For example, the stronger algorithm of ic_global:alldifferent/1 can detect failures before any variables are instantiated, e.g. ?- length(Xs,3), Xs#::1..3, ic_global:alldifferent(Xs), max(Xs)#=2. No (0.00s cpu) which the simple ic:alldifferent/1 implementation misses: ?- length(Xs,3), Xs#::1..3, ic:alldifferent(Xs), max(Xs)#=2. Xs = [_762{[1,2]},_776{[1,2]},_790{[1,2]}] There are 4 delayed goals. Yes (0.00s cpu) To be able to achieve this, ic_global:alldifferent/1 * wakes up on every variable domain reduction * runs an algorithms with a complexity of at least O(N*log(N)) whereby ic:alldifferent/1 * only wakes up when a variable is instantiated * costs only O(N) time Better propagation may lead to a smaller search tree and therefore has the potential for exponential speed-up. But if the extra propagation does not lead to enough search space reduction, the effort is wasted and an overall slowdown can result. This phenomenon is not specific to alldifferent, but to all global constraints where propagation algorithms of different strength and complexity exist. An additional remark: in some cases, it could even be advantageous to call both versions together via [ic,ic_global]:alldifferent(Xs) You then get full strength propagation from ic_global, and potentially quicker discovery of simple failures from the ic version. -- Joachim |
From: Panagiotis S. <ta...@di...> - 2023-04-06 08:55:34
|
Hello All, Is there any possibility for the same program to be more efficient when it uses ic:alldifferent/1 than its counterpart that exploits ic_global:alldifferent/1? It seems quite strange to me and I wonder if I am doing something wrong. Regards, Panagiotis |
From: Panagiotis S. <ta...@di...> - 2023-03-29 13:12:58
|
Hi Joachim, First one is slightly more efficient than the second in my case. Regards, Panagiotis On 29-Mar-23 11:20 AM, Joachim Schimpf via ECLiPSe-CLP-Users wrote: > On 27/03/2023 10:51, Marco Gavanelli wrote: >> >> Anyway, what about: >> >> L[0] = 1 >> >> forall i>0 >> L[i] <= maxlist(L[0..(i-1)]) + 1 >> ? >> >> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of >> the first i elements of the list L. > > > Here are two implementations, one of which may be faster in your > circumstances. > > % version using max(List) > precede1(Xs) :- > eval_to_array(Xs, Xz), > arity(Xz, N), > Xz #:: 1..N, > Xz[1] #= 1, > ( for(I,2,N), param(Xz) do > Xz[I] #=< max(Xz[1..I-1]) + 1 > ). > > % incremental version using max(Xi,Xj) > precede2(Xs) :- > eval_to_array(Xs, Xz), > arity(Xz, N), > Xz #:: 1..N, > ( foreacharg(X,Xz), fromto(0,Max1,Max2,_) do > X #=< Max1 + 1, > Max2 #= max(Max1,X) > ). > > > -- Joachim |
From: Joachim S. <jsc...@co...> - 2023-03-29 08:36:41
|
On 27/03/2023 10:51, Marco Gavanelli wrote: > > Anyway, what about: > > L[0] = 1 > > forall i>0 > L[i] <= maxlist(L[0..(i-1)]) + 1 > ? > > I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of the first > i elements of the list L. Here are two implementations, one of which may be faster in your circumstances. % version using max(List) precede1(Xs) :- eval_to_array(Xs, Xz), arity(Xz, N), Xz #:: 1..N, Xz[1] #= 1, ( for(I,2,N), param(Xz) do Xz[I] #=< max(Xz[1..I-1]) + 1 ). % incremental version using max(Xi,Xj) precede2(Xs) :- eval_to_array(Xs, Xz), arity(Xz, N), Xz #:: 1..N, ( foreacharg(X,Xz), fromto(0,Max1,Max2,_) do X #=< Max1 + 1, Max2 #= max(Max1,X) ). -- Joachim |
From: Panagiotis S. <ta...@di...> - 2023-03-29 04:53:56
|
Hi Kish, On 28-Mar-23 5:08 PM, Kish Shen wrote: > Hi Panaglotis, > > Do you see any pattern to what problems are slower in lib(gfd)? I > would like to study such programs to see if this is a property of > Gecode, or the gfd implementation. I cannot recall at the moment any specific pattern. > I expect that most global constraints will be faster in Gecode, not > only because they are implemented at a C/C++ level, but also because > many of them are probably based on better algorithms. Additionally, > Gecode provides more global constraints than the native solvers. > > When you use lib(gfd), do you do the search in ECLiPSe, or in Gecode? > To do the search in Gecode, you need to use gfd:search/5: > > http://eclipseclp.org/doc/bips/lib/gfd/search-6.html I do the search with gfd_search:search/6. But I see now in the manual that this might not be the best approach. What is more is that I also use bb_min/3 or bb_min/6 from branch_and_bound, which, I realize, might be replaced by the branch-and-bound feature of gfd:search/6. > I expect doing search in Gecode is faster, because you do not keep > switching between ECLiPSe and Gecode, but is less flexible. I would be > interested if you have found cases where doing the search in EC:iPSe > is faster. > > We have not had much feedback on lib(gfd), and welcome any feedback on > it (and of course for any other parts of ECLiPSe) from our users. In conclusion, I think that I have to read the manual more carefully. After that, I might come back with something more definite. Regards, Panagiotis > > Cheers, > > Kish > > On Mon, Mar 27, 2023 at 5:25 PM Panagiotis Stamatopoulos > <ta...@di...> wrote: >> >> Yes, Kish. What I need is also done by precede/2 with lib(gfd). >> >> However, what I have noticed is that although in many cases lib(gfd) >> is faster than lib(ic)/lib(ic_global), which someone would expect to >> be the case, as a compiled C++ code should run faster than a Prolog >> program, there are cases where a lif(gfd) based CP program is quite >> slower than the equivalent one based on the native ECLiPSe constraint >> libraries. >> >> Best Rehards, >> Panagiotis >> >> On 27-Mar-23 4:57 PM, Kish Shen wrote: >>>> And, Hakan, thank you very much for the info on the value_precede_chain >>> >>> This constraint is implemented in Gecode, and is available for ECLiPSe >>> through lib(gfd) as precede/2: >>> >>> http://eclipseclp.org/doc/bips/lib/gfd/precede-2.html >>> >>> Most of Gecode's constraints are available to ECLiiPSe through >>> lib(gdfd). You can check on which constraints are in the various >>> ECLiPSe finite domain libraries at: >>> >>> http://eclipseclp.org/doc/bips/finite-domain_constraints.html >>> >>> Cheers, >>> >>> Kish >>> >>> >>> On Mon, Mar 27, 2023 at 11:28 AM Panagiotis Stamatopoulos >>> <ta...@di...> wrote: >>>> >>>> Yes, it worked!!! Marco, thank you very much, indeed! >>>> >>>> And, Hakan, thank you very much for the info on the value_precede_chain >>>> global constraint. It is exactly what I was looking for, but in an >>>> ECLiPSe environment. Marco's suggestion is actually a simple and >>>> correct implementation of it. >>>> >>>> Best Regards, >>>> Panagiotis >>>> >>>> On 27-Mar-23 12:58 PM, Panagiotis Stamatopoulos wrote: >>>>> Hi Marco, >>>>> >>>>> Yes, you are right. The ultimate purpose of this constraint is >>>>> symmetry breaking. I 'll try what you suggest. Thanks! >>>>> >>>>> Regards, >>>>> Panagiotis >>>>> >>>>> On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: >>>>>> Hi Panagiotis, >>>>>> >>>>>> this constraint reminds me of a symmetry breaking labeling proposed by >>>>>> Pedro Meseguer. >>>>>> >>>>>> Anyway, what about: >>>>>> >>>>>> L[0] = 1 >>>>>> >>>>>> forall i>0 >>>>>> L[i] <= maxlist(L[0..(i-1)]) + 1 >>>>>> ? >>>>>> >>>>>> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of >>>>>> the first i elements of the list L. >>>>>> >>>>>> Best, >>>>>> Marco >>>>>> >>>>>> >>>>>> On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: >>>>>>> Hello Everybody, >>>>>>> >>>>>>> I am seeking ideas on how to implement in ECLiPSe a specific >>>>>>> constraint in a simple, if possible, and efficient way. >>>>>>> >>>>>>> Let L be a list of length N with domain variables ranging >>>>>>> in 1..M. Acceptable lists are the ones that ... >>>>>>> 1. ... contain values from 1 up to K (K =< M), but not any >>>>>>> values from K+1 up to M (K is not given). >>>>>>> 2. ... satisfy the condition that the first occurrences of >>>>>>> the values from 1 to K appear in this order in the list. >>>>>>> >>>>>>> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] >>>>>>> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only >>>>>>> items 1, 2, 3 appear in the list) and the second one has K = 4 >>>>>>> (just 5 is missing from the list). In the first list, the first >>>>>>> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second >>>>>>> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, >>>>>>> 4, 6 in the lists. All fine! >>>>>>> >>>>>>> I believe that the requirement 1 above could be implemented >>>>>>> easily with the occurrences constraint (one for each number in >>>>>>> 1..M) and a set of implication (=>) constraints, stating that >>>>>>> if the number of occurrences of x in 1..M is 0, then the numbers >>>>>>> of occurrences of x+1, x+2, ... in the list should also be 0. >>>>>>> I cannot predict the propagation level of this approach, but >>>>>>> it seems that, at least, declaratively can be stated. >>>>>>> >>>>>>> I don't have any good ideas for the requirement 2. I tried >>>>>>> something that exploits again the occurrences constraint (for >>>>>>> every number in 1..M and every prefix list of the given list) >>>>>>> and then the lex_le constraint. It worked, but if N is around >>>>>>> 50 or more, the efficiency is unacceptable. >>>>>>> >>>>>>> Any ideas on the above would be more than welcome. >>>>>>> >>>>>>> Best Regards, >>>>>>> Panagiotis >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> ECLiPSe-CLP-Users mailing list >>>>>>> ECL...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> ECLiPSe-CLP-Users mailing list >>>>> ECL...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >>>> >>>> >>>> _______________________________________________ >>>> ECLiPSe-CLP-Users mailing list >>>> ECL...@li... >>>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >>> >>> >>> _______________________________________________ >>> ECLiPSe-CLP-Users mailing list >>> ECL...@li... >>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >> >> >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECL...@li... >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Kish S. <kis...@gm...> - 2023-03-28 14:08:40
|
Hi Panaglotis, >there are cases where a lif(gfd) based CP program is quite >slower than the equivalent one based on the native ECLiPSe constraint >libraries. Do you see any pattern to what problems are slower in lib(gfd)? I would like to study such programs to see if this is a property of Gecode, or the gfd implementation. I expect that most global constraints will be faster in Gecode, not only because they are implemented at a C/C++ level, but also because many of them are probably based on better algorithms. Additionally, Gecode provides more global constraints than the native solvers. When you use lib(gfd), do you do the search in ECLiPSe, or in Gecode? To do the search in Gecode, you need to use gfd:search/5: http://eclipseclp.org/doc/bips/lib/gfd/search-6.html I expect doing search in Gecode is faster, because you do not keep switching between ECLiPSe and Gecode, but is less flexible. I would be interested if you have found cases where doing the search in EC:iPSe is faster. We have not had much feedback on lib(gfd), and welcome any feedback on it (and of course for any other parts of ECLiPSe) from our users. Cheers, Kish On Mon, Mar 27, 2023 at 5:25 PM Panagiotis Stamatopoulos <ta...@di...> wrote: > > Yes, Kish. What I need is also done by precede/2 with lib(gfd). > > However, what I have noticed is that although in many cases lib(gfd) > is faster than lib(ic)/lib(ic_global), which someone would expect to > be the case, as a compiled C++ code should run faster than a Prolog > program, there are cases where a lif(gfd) based CP program is quite > slower than the equivalent one based on the native ECLiPSe constraint > libraries. > > Best Rehards, > Panagiotis > > On 27-Mar-23 4:57 PM, Kish Shen wrote: > >> And, Hakan, thank you very much for the info on the value_precede_chain > > > > This constraint is implemented in Gecode, and is available for ECLiPSe > > through lib(gfd) as precede/2: > > > > http://eclipseclp.org/doc/bips/lib/gfd/precede-2.html > > > > Most of Gecode's constraints are available to ECLiiPSe through > > lib(gdfd). You can check on which constraints are in the various > > ECLiPSe finite domain libraries at: > > > > http://eclipseclp.org/doc/bips/finite-domain_constraints.html > > > > Cheers, > > > > Kish > > > > > > On Mon, Mar 27, 2023 at 11:28 AM Panagiotis Stamatopoulos > > <ta...@di...> wrote: > >> > >> Yes, it worked!!! Marco, thank you very much, indeed! > >> > >> And, Hakan, thank you very much for the info on the value_precede_chain > >> global constraint. It is exactly what I was looking for, but in an > >> ECLiPSe environment. Marco's suggestion is actually a simple and > >> correct implementation of it. > >> > >> Best Regards, > >> Panagiotis > >> > >> On 27-Mar-23 12:58 PM, Panagiotis Stamatopoulos wrote: > >>> Hi Marco, > >>> > >>> Yes, you are right. The ultimate purpose of this constraint is > >>> symmetry breaking. I 'll try what you suggest. Thanks! > >>> > >>> Regards, > >>> Panagiotis > >>> > >>> On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: > >>>> Hi Panagiotis, > >>>> > >>>> this constraint reminds me of a symmetry breaking labeling proposed by > >>>> Pedro Meseguer. > >>>> > >>>> Anyway, what about: > >>>> > >>>> L[0] = 1 > >>>> > >>>> forall i>0 > >>>> L[i] <= maxlist(L[0..(i-1)]) + 1 > >>>> ? > >>>> > >>>> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of > >>>> the first i elements of the list L. > >>>> > >>>> Best, > >>>> Marco > >>>> > >>>> > >>>> On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: > >>>>> Hello Everybody, > >>>>> > >>>>> I am seeking ideas on how to implement in ECLiPSe a specific > >>>>> constraint in a simple, if possible, and efficient way. > >>>>> > >>>>> Let L be a list of length N with domain variables ranging > >>>>> in 1..M. Acceptable lists are the ones that ... > >>>>> 1. ... contain values from 1 up to K (K =< M), but not any > >>>>> values from K+1 up to M (K is not given). > >>>>> 2. ... satisfy the condition that the first occurrences of > >>>>> the values from 1 to K appear in this order in the list. > >>>>> > >>>>> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] > >>>>> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only > >>>>> items 1, 2, 3 appear in the list) and the second one has K = 4 > >>>>> (just 5 is missing from the list). In the first list, the first > >>>>> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second > >>>>> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, > >>>>> 4, 6 in the lists. All fine! > >>>>> > >>>>> I believe that the requirement 1 above could be implemented > >>>>> easily with the occurrences constraint (one for each number in > >>>>> 1..M) and a set of implication (=>) constraints, stating that > >>>>> if the number of occurrences of x in 1..M is 0, then the numbers > >>>>> of occurrences of x+1, x+2, ... in the list should also be 0. > >>>>> I cannot predict the propagation level of this approach, but > >>>>> it seems that, at least, declaratively can be stated. > >>>>> > >>>>> I don't have any good ideas for the requirement 2. I tried > >>>>> something that exploits again the occurrences constraint (for > >>>>> every number in 1..M and every prefix list of the given list) > >>>>> and then the lex_le constraint. It worked, but if N is around > >>>>> 50 or more, the efficiency is unacceptable. > >>>>> > >>>>> Any ideas on the above would be more than welcome. > >>>>> > >>>>> Best Regards, > >>>>> Panagiotis > >>>>> > >>>>> > >>>>> _______________________________________________ > >>>>> ECLiPSe-CLP-Users mailing list > >>>>> ECL...@li... > >>>>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > >>>> > >>> > >>> > >>> _______________________________________________ > >>> ECLiPSe-CLP-Users mailing list > >>> ECL...@li... > >>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > >> > >> > >> _______________________________________________ > >> ECLiPSe-CLP-Users mailing list > >> ECL...@li... > >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > > > > _______________________________________________ > > ECLiPSe-CLP-Users mailing list > > ECL...@li... > > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Panagiotis S. <ta...@di...> - 2023-03-27 16:25:22
|
Yes, Kish. What I need is also done by precede/2 with lib(gfd). However, what I have noticed is that although in many cases lib(gfd) is faster than lib(ic)/lib(ic_global), which someone would expect to be the case, as a compiled C++ code should run faster than a Prolog program, there are cases where a lif(gfd) based CP program is quite slower than the equivalent one based on the native ECLiPSe constraint libraries. Best Rehards, Panagiotis On 27-Mar-23 4:57 PM, Kish Shen wrote: >> And, Hakan, thank you very much for the info on the value_precede_chain > > This constraint is implemented in Gecode, and is available for ECLiPSe > through lib(gfd) as precede/2: > > http://eclipseclp.org/doc/bips/lib/gfd/precede-2.html > > Most of Gecode's constraints are available to ECLiiPSe through > lib(gdfd). You can check on which constraints are in the various > ECLiPSe finite domain libraries at: > > http://eclipseclp.org/doc/bips/finite-domain_constraints.html > > Cheers, > > Kish > > > On Mon, Mar 27, 2023 at 11:28 AM Panagiotis Stamatopoulos > <ta...@di...> wrote: >> >> Yes, it worked!!! Marco, thank you very much, indeed! >> >> And, Hakan, thank you very much for the info on the value_precede_chain >> global constraint. It is exactly what I was looking for, but in an >> ECLiPSe environment. Marco's suggestion is actually a simple and >> correct implementation of it. >> >> Best Regards, >> Panagiotis >> >> On 27-Mar-23 12:58 PM, Panagiotis Stamatopoulos wrote: >>> Hi Marco, >>> >>> Yes, you are right. The ultimate purpose of this constraint is >>> symmetry breaking. I 'll try what you suggest. Thanks! >>> >>> Regards, >>> Panagiotis >>> >>> On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: >>>> Hi Panagiotis, >>>> >>>> this constraint reminds me of a symmetry breaking labeling proposed by >>>> Pedro Meseguer. >>>> >>>> Anyway, what about: >>>> >>>> L[0] = 1 >>>> >>>> forall i>0 >>>> L[i] <= maxlist(L[0..(i-1)]) + 1 >>>> ? >>>> >>>> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of >>>> the first i elements of the list L. >>>> >>>> Best, >>>> Marco >>>> >>>> >>>> On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: >>>>> Hello Everybody, >>>>> >>>>> I am seeking ideas on how to implement in ECLiPSe a specific >>>>> constraint in a simple, if possible, and efficient way. >>>>> >>>>> Let L be a list of length N with domain variables ranging >>>>> in 1..M. Acceptable lists are the ones that ... >>>>> 1. ... contain values from 1 up to K (K =< M), but not any >>>>> values from K+1 up to M (K is not given). >>>>> 2. ... satisfy the condition that the first occurrences of >>>>> the values from 1 to K appear in this order in the list. >>>>> >>>>> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] >>>>> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only >>>>> items 1, 2, 3 appear in the list) and the second one has K = 4 >>>>> (just 5 is missing from the list). In the first list, the first >>>>> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second >>>>> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, >>>>> 4, 6 in the lists. All fine! >>>>> >>>>> I believe that the requirement 1 above could be implemented >>>>> easily with the occurrences constraint (one for each number in >>>>> 1..M) and a set of implication (=>) constraints, stating that >>>>> if the number of occurrences of x in 1..M is 0, then the numbers >>>>> of occurrences of x+1, x+2, ... in the list should also be 0. >>>>> I cannot predict the propagation level of this approach, but >>>>> it seems that, at least, declaratively can be stated. >>>>> >>>>> I don't have any good ideas for the requirement 2. I tried >>>>> something that exploits again the occurrences constraint (for >>>>> every number in 1..M and every prefix list of the given list) >>>>> and then the lex_le constraint. It worked, but if N is around >>>>> 50 or more, the efficiency is unacceptable. >>>>> >>>>> Any ideas on the above would be more than welcome. >>>>> >>>>> Best Regards, >>>>> Panagiotis >>>>> >>>>> >>>>> _______________________________________________ >>>>> ECLiPSe-CLP-Users mailing list >>>>> ECL...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >>>> >>> >>> >>> _______________________________________________ >>> ECLiPSe-CLP-Users mailing list >>> ECL...@li... >>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >> >> >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECL...@li... >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Kish S. <kis...@gm...> - 2023-03-27 13:57:51
|
>And, Hakan, thank you very much for the info on the value_precede_chain This constraint is implemented in Gecode, and is available for ECLiPSe through lib(gfd) as precede/2: http://eclipseclp.org/doc/bips/lib/gfd/precede-2.html Most of Gecode's constraints are available to ECLiiPSe through lib(gdfd). You can check on which constraints are in the various ECLiPSe finite domain libraries at: http://eclipseclp.org/doc/bips/finite-domain_constraints.html Cheers, Kish On Mon, Mar 27, 2023 at 11:28 AM Panagiotis Stamatopoulos <ta...@di...> wrote: > > Yes, it worked!!! Marco, thank you very much, indeed! > > And, Hakan, thank you very much for the info on the value_precede_chain > global constraint. It is exactly what I was looking for, but in an > ECLiPSe environment. Marco's suggestion is actually a simple and > correct implementation of it. > > Best Regards, > Panagiotis > > On 27-Mar-23 12:58 PM, Panagiotis Stamatopoulos wrote: > > Hi Marco, > > > > Yes, you are right. The ultimate purpose of this constraint is > > symmetry breaking. I 'll try what you suggest. Thanks! > > > > Regards, > > Panagiotis > > > > On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: > >> Hi Panagiotis, > >> > >> this constraint reminds me of a symmetry breaking labeling proposed by > >> Pedro Meseguer. > >> > >> Anyway, what about: > >> > >> L[0] = 1 > >> > >> forall i>0 > >> L[i] <= maxlist(L[0..(i-1)]) + 1 > >> ? > >> > >> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of > >> the first i elements of the list L. > >> > >> Best, > >> Marco > >> > >> > >> On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: > >>> Hello Everybody, > >>> > >>> I am seeking ideas on how to implement in ECLiPSe a specific > >>> constraint in a simple, if possible, and efficient way. > >>> > >>> Let L be a list of length N with domain variables ranging > >>> in 1..M. Acceptable lists are the ones that ... > >>> 1. ... contain values from 1 up to K (K =< M), but not any > >>> values from K+1 up to M (K is not given). > >>> 2. ... satisfy the condition that the first occurrences of > >>> the values from 1 to K appear in this order in the list. > >>> > >>> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] > >>> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only > >>> items 1, 2, 3 appear in the list) and the second one has K = 4 > >>> (just 5 is missing from the list). In the first list, the first > >>> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second > >>> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, > >>> 4, 6 in the lists. All fine! > >>> > >>> I believe that the requirement 1 above could be implemented > >>> easily with the occurrences constraint (one for each number in > >>> 1..M) and a set of implication (=>) constraints, stating that > >>> if the number of occurrences of x in 1..M is 0, then the numbers > >>> of occurrences of x+1, x+2, ... in the list should also be 0. > >>> I cannot predict the propagation level of this approach, but > >>> it seems that, at least, declaratively can be stated. > >>> > >>> I don't have any good ideas for the requirement 2. I tried > >>> something that exploits again the occurrences constraint (for > >>> every number in 1..M and every prefix list of the given list) > >>> and then the lex_le constraint. It worked, but if N is around > >>> 50 or more, the efficiency is unacceptable. > >>> > >>> Any ideas on the above would be more than welcome. > >>> > >>> Best Regards, > >>> Panagiotis > >>> > >>> > >>> _______________________________________________ > >>> ECLiPSe-CLP-Users mailing list > >>> ECL...@li... > >>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > >> > > > > > > _______________________________________________ > > ECLiPSe-CLP-Users mailing list > > ECL...@li... > > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Panagiotis S. <ta...@di...> - 2023-03-27 10:27:56
|
Yes, it worked!!! Marco, thank you very much, indeed! And, Hakan, thank you very much for the info on the value_precede_chain global constraint. It is exactly what I was looking for, but in an ECLiPSe environment. Marco's suggestion is actually a simple and correct implementation of it. Best Regards, Panagiotis On 27-Mar-23 12:58 PM, Panagiotis Stamatopoulos wrote: > Hi Marco, > > Yes, you are right. The ultimate purpose of this constraint is > symmetry breaking. I 'll try what you suggest. Thanks! > > Regards, > Panagiotis > > On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: >> Hi Panagiotis, >> >> this constraint reminds me of a symmetry breaking labeling proposed by >> Pedro Meseguer. >> >> Anyway, what about: >> >> L[0] = 1 >> >> forall i>0 >> L[i] <= maxlist(L[0..(i-1)]) + 1 >> ? >> >> I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of >> the first i elements of the list L. >> >> Best, >> Marco >> >> >> On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: >>> Hello Everybody, >>> >>> I am seeking ideas on how to implement in ECLiPSe a specific >>> constraint in a simple, if possible, and efficient way. >>> >>> Let L be a list of length N with domain variables ranging >>> in 1..M. Acceptable lists are the ones that ... >>> 1. ... contain values from 1 up to K (K =< M), but not any >>> values from K+1 up to M (K is not given). >>> 2. ... satisfy the condition that the first occurrences of >>> the values from 1 to K appear in this order in the list. >>> >>> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] >>> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only >>> items 1, 2, 3 appear in the list) and the second one has K = 4 >>> (just 5 is missing from the list). In the first list, the first >>> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second >>> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, >>> 4, 6 in the lists. All fine! >>> >>> I believe that the requirement 1 above could be implemented >>> easily with the occurrences constraint (one for each number in >>> 1..M) and a set of implication (=>) constraints, stating that >>> if the number of occurrences of x in 1..M is 0, then the numbers >>> of occurrences of x+1, x+2, ... in the list should also be 0. >>> I cannot predict the propagation level of this approach, but >>> it seems that, at least, declaratively can be stated. >>> >>> I don't have any good ideas for the requirement 2. I tried >>> something that exploits again the occurrences constraint (for >>> every number in 1..M and every prefix list of the given list) >>> and then the lex_le constraint. It worked, but if N is around >>> 50 or more, the efficiency is unacceptable. >>> >>> Any ideas on the above would be more than welcome. >>> >>> Best Regards, >>> Panagiotis >>> >>> >>> _______________________________________________ >>> ECLiPSe-CLP-Users mailing list >>> ECL...@li... >>> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users >> > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Hakan K. <ha...@gm...> - 2023-03-27 10:08:50
|
There is a global constraint called value_precede_chain ( https://sofdem.github.io/gccat/gccat/Cint_value_precede_chain.html) which seems to be what you want. It ensures that the first occurrence of the value I must be placed in the array before any values > I. I don't have any ECLiPSe CLP code for this, but there's an MiniZinc code here: https://github.com/MiniZinc/libminizinc/blob/master/share/minizinc/std/fzn_value_precede_chain_int.mzn . And I've ported the MiniZinc code to Picat: http://hakank.org/picat/value_precede_chain.pi . Hope this helps. Best, Hakan On Mon, Mar 27, 2023 at 11:59 AM Panagiotis Stamatopoulos <ta...@di...> wrote: > Hi Marco, > > Yes, you are right. The ultimate purpose of this constraint is > symmetry breaking. I 'll try what you suggest. Thanks! > > Regards, > Panagiotis > > On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: > > Hi Panagiotis, > > > > this constraint reminds me of a symmetry breaking labeling proposed by > > Pedro Meseguer. > > > > Anyway, what about: > > > > L[0] = 1 > > > > forall i>0 > > L[i] <= maxlist(L[0..(i-1)]) + 1 > > ? > > > > I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of > > the first i elements of the list L. > > > > Best, > > Marco > > > > > > On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: > >> Hello Everybody, > >> > >> I am seeking ideas on how to implement in ECLiPSe a specific > >> constraint in a simple, if possible, and efficient way. > >> > >> Let L be a list of length N with domain variables ranging > >> in 1..M. Acceptable lists are the ones that ... > >> 1. ... contain values from 1 up to K (K =< M), but not any > >> values from K+1 up to M (K is not given). > >> 2. ... satisfy the condition that the first occurrences of > >> the values from 1 to K appear in this order in the list. > >> > >> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] > >> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only > >> items 1, 2, 3 appear in the list) and the second one has K = 4 > >> (just 5 is missing from the list). In the first list, the first > >> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second > >> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, > >> 4, 6 in the lists. All fine! > >> > >> I believe that the requirement 1 above could be implemented > >> easily with the occurrences constraint (one for each number in > >> 1..M) and a set of implication (=>) constraints, stating that > >> if the number of occurrences of x in 1..M is 0, then the numbers > >> of occurrences of x+1, x+2, ... in the list should also be 0. > >> I cannot predict the propagation level of this approach, but > >> it seems that, at least, declaratively can be stated. > >> > >> I don't have any good ideas for the requirement 2. I tried > >> something that exploits again the occurrences constraint (for > >> every number in 1..M and every prefix list of the given list) > >> and then the lex_le constraint. It worked, but if N is around > >> 50 or more, the efficiency is unacceptable. > >> > >> Any ideas on the above would be more than welcome. > >> > >> Best Regards, > >> Panagiotis > >> > >> > >> _______________________________________________ > >> ECLiPSe-CLP-Users mailing list > >> ECL...@li... > >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > -- Hakan Kjellerstrand http://www.hakank.org/ http://www.hakank.org/webblogg/ http://www.hakank.org/constraint_programming_blog/ http://twitter.com/hakankj https://www.facebook.com/hakankj |
From: Panagiotis S. <ta...@di...> - 2023-03-27 09:58:48
|
Hi Marco, Yes, you are right. The ultimate purpose of this constraint is symmetry breaking. I 'll try what you suggest. Thanks! Regards, Panagiotis On 27-Mar-23 12:51 PM, Marco Gavanelli wrote: > Hi Panagiotis, > > this constraint reminds me of a symmetry breaking labeling proposed by > Pedro Meseguer. > > Anyway, what about: > > L[0] = 1 > > forall i>0 > L[i] <= maxlist(L[0..(i-1)]) + 1 > ? > > I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of > the first i elements of the list L. > > Best, > Marco > > > On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: >> Hello Everybody, >> >> I am seeking ideas on how to implement in ECLiPSe a specific >> constraint in a simple, if possible, and efficient way. >> >> Let L be a list of length N with domain variables ranging >> in 1..M. Acceptable lists are the ones that ... >> 1. ... contain values from 1 up to K (K =< M), but not any >> values from K+1 up to M (K is not given). >> 2. ... satisfy the condition that the first occurrences of >> the values from 1 to K appear in this order in the list. >> >> For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] >> and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only >> items 1, 2, 3 appear in the list) and the second one has K = 4 >> (just 5 is missing from the list). In the first list, the first >> occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second >> list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, >> 4, 6 in the lists. All fine! >> >> I believe that the requirement 1 above could be implemented >> easily with the occurrences constraint (one for each number in >> 1..M) and a set of implication (=>) constraints, stating that >> if the number of occurrences of x in 1..M is 0, then the numbers >> of occurrences of x+1, x+2, ... in the list should also be 0. >> I cannot predict the propagation level of this approach, but >> it seems that, at least, declaratively can be stated. >> >> I don't have any good ideas for the requirement 2. I tried >> something that exploits again the occurrences constraint (for >> every number in 1..M and every prefix list of the given list) >> and then the lex_le constraint. It worked, but if N is around >> 50 or more, the efficiency is unacceptable. >> >> Any ideas on the above would be more than welcome. >> >> Best Regards, >> Panagiotis >> >> >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECL...@li... >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > |
From: Marco G. <mar...@un...> - 2023-03-27 09:51:33
|
Hi Panagiotis, this constraint reminds me of a symmetry breaking labeling proposed by Pedro Meseguer. Anyway, what about: L[0] = 1 forall i>0 L[i] <= maxlist(L[0..(i-1)]) + 1 ? I hope the intuition is clear, with L[0..(1-i)] I mean the sublist of the first i elements of the list L. Best, Marco On 27/03/2023 11:34, Panagiotis Stamatopoulos wrote: > Hello Everybody, > > I am seeking ideas on how to implement in ECLiPSe a specific > constraint in a simple, if possible, and efficient way. > > Let L be a list of length N with domain variables ranging > in 1..M. Acceptable lists are the ones that ... > 1. ... contain values from 1 up to K (K =< M), but not any > values from K+1 up to M (K is not given). > 2. ... satisfy the condition that the first occurrences of > the values from 1 to K appear in this order in the list. > > For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] > and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only > items 1, 2, 3 appear in the list) and the second one has K = 4 > (just 5 is missing from the list). In the first list, the first > occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second > list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, > 4, 6 in the lists. All fine! > > I believe that the requirement 1 above could be implemented > easily with the occurrences constraint (one for each number in > 1..M) and a set of implication (=>) constraints, stating that > if the number of occurrences of x in 1..M is 0, then the numbers > of occurrences of x+1, x+2, ... in the list should also be 0. > I cannot predict the propagation level of this approach, but > it seems that, at least, declaratively can be stated. > > I don't have any good ideas for the requirement 2. I tried > something that exploits again the occurrences constraint (for > every number in 1..M and every prefix list of the given list) > and then the lex_le constraint. It worked, but if N is around > 50 or more, the efficiency is unacceptable. > > Any ideas on the above would be more than welcome. > > Best Regards, > Panagiotis > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users -- Marco Gavanelli Coordinator of the courses -L8 Electronics and Computer Science Engineering -LM29 Electronics Engineering for ICT -LM32 Computer Science and Automation Engineering Associate Professor Ph.D. in Computer Science Engineering Dept of Engineering University of Ferrara Tel/Fax +39-0532-97-4833 http://docente.unife.it/marco.gavanelli |
From: Panagiotis S. <ta...@di...> - 2023-03-27 09:34:49
|
Hello Everybody, I am seeking ideas on how to implement in ECLiPSe a specific constraint in a simple, if possible, and efficient way. Let L be a list of length N with domain variables ranging in 1..M. Acceptable lists are the ones that ... 1. ... contain values from 1 up to K (K =< M), but not any values from K+1 up to M (K is not given). 2. ... satisfy the condition that the first occurrences of the values from 1 to K appear in this order in the list. For example, let N = 8 and M = 5. The lists [1,1,2,1,2,3,2,1] and [1,2,1,3,2,4,3,1] are valid. The first one has K = 3 (only items 1, 2, 3 appear in the list) and the second one has K = 4 (just 5 is missing from the list). In the first list, the first occurrences of 1, 2, 3 are in positions 1, 3, 6 and in the second list, the first occurrences of 1, 2, 3, 4 are in positions 1, 2, 4, 6 in the lists. All fine! I believe that the requirement 1 above could be implemented easily with the occurrences constraint (one for each number in 1..M) and a set of implication (=>) constraints, stating that if the number of occurrences of x in 1..M is 0, then the numbers of occurrences of x+1, x+2, ... in the list should also be 0. I cannot predict the propagation level of this approach, but it seems that, at least, declaratively can be stated. I don't have any good ideas for the requirement 2. I tried something that exploits again the occurrences constraint (for every number in 1..M and every prefix list of the given list) and then the lex_le constraint. It worked, but if N is around 50 or more, the efficiency is unacceptable. Any ideas on the above would be more than welcome. Best Regards, Panagiotis |
From: Panagiotis S. <ta...@di...> - 2023-02-21 12:02:16
|
Dear Marco, I tried both approaches you suggested. The alldifferent_matrix one didn't work well. It was very inefficient. Maybe because the grid representation is a list of lists, which I transformed to a matrix, in order to post the alldifferent constraint, while the rest of the program deals with lists? I don't know. But the second approach, with the lists of the maxima, the ordered constraint and the gfd nvalues one worked incredibly. It gave a speedup of almost an order of magnitude (x10) compared to my previous approach, based on the query of my first message. Thank you very much! Best Regards, Panagiotis On 20-Feb-23 11:40 PM, Marco Gavanelli wrote: > Dear Panagiotis, > > of course Propia is for rapid prototyping, if you want a fast > implementation of the constraint you can implement it with suspensions. > > However, after seeing the whole problem, I think that in order to have a > better speedup you should try and use global constraints as much as > possible. > > A simple one is alldifferent_matrix. > > Another idea could be the following: > for each row [X1,X2,...] you have a further list of variables > [M1,M2,...] where (foreach i), Mi = max([X1,...,Xi]). > > Now, the list [M1,M2,...] is sorted, so you can impose the ordered > constraint on it. > Also, the number of distinct elements in [M1,M2,...] is exactly the > number of skyscrapers you see, so you might use the nvalues constraint > (available in gfd). > > I haven't tried these, though. > > Best, > Marco > > > On 20/02/2023 18:28, Panagiotis Stamatopoulos wrote: >> Thank you very much, Marco. I tried your suggestion and it works >> as you describe, as far as the constraint propagation is concerned. >> >> However, my original problem was to implement an ic-based (or >> gfd-based) solution for the puzzle here: >> https://www.puzzle-skyscrapers.com/ >> >> I got a solution, quite easily, which works well for small and medium >> size instances, but is very inefficient for larger ones (N > 7). When >> I injected your propia-based suggestion, the program was even more >> inefficient. My assumption is - might be wrong, though - that propia >> introduces an overhead which does not pay off, despite the fact that >> we have more propagation. I 'll try some more alternatives that I >> have in mind and see if things get better. As far as the heuristics >> in the search is concerned, it seems that most_constrained/indomain__max >> is the best combination for variable/value selection. >> >> Anyway, thank you very much again for your time. If there is any >> suggestion on a way to express more efficiently, compared to the >> approach that can be inferred from the query in my previouw message, >> the constraints of the problem above that refer to the numbers of >> visible skyscrapers from the side points, I would be glad to hear it. >> >> Best Regards, >> Panagiotis >> >> On 20-Feb-23 1:54 PM, Marco Gavanelli wrote: >>> Hi, >>> >>> On 20/02/2023 11:27, Panagiotis Stamatopoulos wrote: >>>> Hello Everybody, >>>> >>>> After having loaded libraries ic and ic_global, we give the query: >>>> >>>> ?- N = 4, Count = 0, length(L, N), L #:: 1..N, >>>> ic_global:alldifferent(L), L = [X1,X2,X3,X4], (X2 #> X1) + (X3 #> >>>> max([X1,X2])) + (X4 #> max([X1,X2,X3])) #= Count. >>>> >>>> N = 4 >>>> Count = 0 >>>> L = [X1{1 .. 4}, X2{1 .. 4}, X3{1 .. 4}, X4{1 .. 4}] >>>> X1 = X1{1 .. 4} >>>> X2 = X2{1 .. 4} >>>> X3 = X3{1 .. 4} >>>> X4 = X4{1 .. 4} >>>> There are 6 delayed goals. >>>> Yes (0.00s cpu) >>>> >>>> As we may see, from the query we can infer that X1 = 4. Is there >>>> any alternative way to pose the query in order to get this result? >>>> Note that Count might be anything between 0 and 3 (if we assign it >>>> the value 3, we get the answer X1 = 1, X2 = 2, X3 = 3, X4 = 4, >>>> as we might expect). But what if Count is less than 3? How could >>>> we get the most propagation possible? >>> >>> With Count=0 the solver infers that >>> (X2 #> X1) #= 0 >>> i.e. >>> X2 #=< X1 >>> >>> I guess you would like to combine that information with the >>> alldifferent constraint, and obtain the stronger constraint >>> >>> X2 #< X1. >>> >>> One way to achieve this propagation could be to use, instead of the >>> #< /3 constraint, a constraint that excludes the possibility of >>> having X2 = X1 (i.e., either X1 < X2 or X2 > X1). For example: >>> >>> :- lib(propia). >>> mygt(X,Y,B):- mygt1(X,Y,B) infers most. >>> mygt1(A,B,1):- A #> B. >>> mygt1(A,B,0):- A #< B. >>> >>> Now this constraint can be used instead of #< /3 : >>> >>> ?- N=4, Count=0, L = [X1,X2,X3,X4], length(L, N), L #:: 1..N, >>> ic_global:alldifferent(L), mygt(X2,X1,B1), M12 #= max([X1,X2]), >>> mygt(X3,M12,B2), M123 #= max([X1,X2,X3]), mygt(X4,M123,B3), >>> sumlist([B1,B2,B3]) #= Count. >>> >>> N = 4 >>> Count = 0 >>> L = [4, X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}] >>> X1 = 4 >>> X2 = X2{1 .. 3} >>> X3 = X3{1 .. 3} >>> X4 = X4{1 .. 3} >>> B1 = 0 >>> M12 = 4 >>> B2 = 0 >>> M123 = 4 >>> B3 = 0 >>> >>> >>> Delayed goals: >>> mygt1(X2{1 .. 3}, 4, 0) infers most >>> mygt1(X3{1 .. 3}, 4, 0) infers most >>> mygt1(X4{1 .. 3}, 4, 0) infers most >>> alldifferent([X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}], 1) >>> Yes (0.00s cpu) >>> >>> Cheers, >>> Marco >>> >> >> >> _______________________________________________ >> ECLiPSe-CLP-Users mailing list >> ECL...@li... >> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > |
From: Marco G. <mar...@un...> - 2023-02-20 22:09:38
|
Dear Panagiotis, of course Propia is for rapid prototyping, if you want a fast implementation of the constraint you can implement it with suspensions. However, after seeing the whole problem, I think that in order to have a better speedup you should try and use global constraints as much as possible. A simple one is alldifferent_matrix. Another idea could be the following: for each row [X1,X2,...] you have a further list of variables [M1,M2,...] where (foreach i), Mi = max([X1,...,Xi]). Now, the list [M1,M2,...] is sorted, so you can impose the ordered constraint on it. Also, the number of distinct elements in [M1,M2,...] is exactly the number of skyscrapers you see, so you might use the nvalues constraint (available in gfd). I haven't tried these, though. Best, Marco On 20/02/2023 18:28, Panagiotis Stamatopoulos wrote: > Thank you very much, Marco. I tried your suggestion and it works > as you describe, as far as the constraint propagation is concerned. > > However, my original problem was to implement an ic-based (or > gfd-based) solution for the puzzle here: > https://www.puzzle-skyscrapers.com/ > > I got a solution, quite easily, which works well for small and medium > size instances, but is very inefficient for larger ones (N > 7). When > I injected your propia-based suggestion, the program was even more > inefficient. My assumption is - might be wrong, though - that propia > introduces an overhead which does not pay off, despite the fact that > we have more propagation. I 'll try some more alternatives that I > have in mind and see if things get better. As far as the heuristics > in the search is concerned, it seems that most_constrained/indomain__max > is the best combination for variable/value selection. > > Anyway, thank you very much again for your time. If there is any > suggestion on a way to express more efficiently, compared to the > approach that can be inferred from the query in my previouw message, > the constraints of the problem above that refer to the numbers of > visible skyscrapers from the side points, I would be glad to hear it. > > Best Regards, > Panagiotis > > On 20-Feb-23 1:54 PM, Marco Gavanelli wrote: >> Hi, >> >> On 20/02/2023 11:27, Panagiotis Stamatopoulos wrote: >>> Hello Everybody, >>> >>> After having loaded libraries ic and ic_global, we give the query: >>> >>> ?- N = 4, Count = 0, length(L, N), L #:: 1..N, >>> ic_global:alldifferent(L), L = [X1,X2,X3,X4], (X2 #> X1) + (X3 #> >>> max([X1,X2])) + (X4 #> max([X1,X2,X3])) #= Count. >>> >>> N = 4 >>> Count = 0 >>> L = [X1{1 .. 4}, X2{1 .. 4}, X3{1 .. 4}, X4{1 .. 4}] >>> X1 = X1{1 .. 4} >>> X2 = X2{1 .. 4} >>> X3 = X3{1 .. 4} >>> X4 = X4{1 .. 4} >>> There are 6 delayed goals. >>> Yes (0.00s cpu) >>> >>> As we may see, from the query we can infer that X1 = 4. Is there >>> any alternative way to pose the query in order to get this result? >>> Note that Count might be anything between 0 and 3 (if we assign it >>> the value 3, we get the answer X1 = 1, X2 = 2, X3 = 3, X4 = 4, >>> as we might expect). But what if Count is less than 3? How could >>> we get the most propagation possible? >> >> With Count=0 the solver infers that >> (X2 #> X1) #= 0 >> i.e. >> X2 #=< X1 >> >> I guess you would like to combine that information with the >> alldifferent constraint, and obtain the stronger constraint >> >> X2 #< X1. >> >> One way to achieve this propagation could be to use, instead of the #< >> /3 constraint, a constraint that excludes the possibility of having X2 >> = X1 (i.e., either X1 < X2 or X2 > X1). For example: >> >> :- lib(propia). >> mygt(X,Y,B):- mygt1(X,Y,B) infers most. >> mygt1(A,B,1):- A #> B. >> mygt1(A,B,0):- A #< B. >> >> Now this constraint can be used instead of #< /3 : >> >> ?- N=4, Count=0, L = [X1,X2,X3,X4], length(L, N), L #:: 1..N, >> ic_global:alldifferent(L), mygt(X2,X1,B1), M12 #= max([X1,X2]), >> mygt(X3,M12,B2), M123 #= max([X1,X2,X3]), mygt(X4,M123,B3), >> sumlist([B1,B2,B3]) #= Count. >> >> N = 4 >> Count = 0 >> L = [4, X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}] >> X1 = 4 >> X2 = X2{1 .. 3} >> X3 = X3{1 .. 3} >> X4 = X4{1 .. 3} >> B1 = 0 >> M12 = 4 >> B2 = 0 >> M123 = 4 >> B3 = 0 >> >> >> Delayed goals: >> mygt1(X2{1 .. 3}, 4, 0) infers most >> mygt1(X3{1 .. 3}, 4, 0) infers most >> mygt1(X4{1 .. 3}, 4, 0) infers most >> alldifferent([X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}], 1) >> Yes (0.00s cpu) >> >> Cheers, >> Marco >> > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users -- Marco Gavanelli Coordinator of the courses -L8 Electronics and Computer Science Engineering -LM29 Electronics Engineering for ICT -LM32 Computer Science and Automation Engineering Associate Professor Ph.D. in Computer Science Engineering Dept of Engineering University of Ferrara Tel/Fax +39-0532-97-4833 http://docente.unife.it/marco.gavanelli |
From: Panagiotis S. <ta...@di...> - 2023-02-20 18:00:22
|
Thank you very much, Marco. I tried your suggestion and it works as you describe, as far as the constraint propagation is concerned. However, my original problem was to implement an ic-based (or gfd-based) solution for the puzzle here: https://www.puzzle-skyscrapers.com/ I got a solution, quite easily, which works well for small and medium size instances, but is very inefficient for larger ones (N > 7). When I injected your propia-based suggestion, the program was even more inefficient. My assumption is - might be wrong, though - that propia introduces an overhead which does not pay off, despite the fact that we have more propagation. I 'll try some more alternatives that I have in mind and see if things get better. As far as the heuristics in the search is concerned, it seems that most_constrained/indomain__max is the best combination for variable/value selection. Anyway, thank you very much again for your time. If there is any suggestion on a way to express more efficiently, compared to the approach that can be inferred from the query in my previouw message, the constraints of the problem above that refer to the numbers of visible skyscrapers from the side points, I would be glad to hear it. Best Regards, Panagiotis On 20-Feb-23 1:54 PM, Marco Gavanelli wrote: > Hi, > > On 20/02/2023 11:27, Panagiotis Stamatopoulos wrote: >> Hello Everybody, >> >> After having loaded libraries ic and ic_global, we give the query: >> >> ?- N = 4, Count = 0, length(L, N), L #:: 1..N, >> ic_global:alldifferent(L), L = [X1,X2,X3,X4], (X2 #> X1) + (X3 #> >> max([X1,X2])) + (X4 #> max([X1,X2,X3])) #= Count. >> >> N = 4 >> Count = 0 >> L = [X1{1 .. 4}, X2{1 .. 4}, X3{1 .. 4}, X4{1 .. 4}] >> X1 = X1{1 .. 4} >> X2 = X2{1 .. 4} >> X3 = X3{1 .. 4} >> X4 = X4{1 .. 4} >> There are 6 delayed goals. >> Yes (0.00s cpu) >> >> As we may see, from the query we can infer that X1 = 4. Is there >> any alternative way to pose the query in order to get this result? >> Note that Count might be anything between 0 and 3 (if we assign it >> the value 3, we get the answer X1 = 1, X2 = 2, X3 = 3, X4 = 4, >> as we might expect). But what if Count is less than 3? How could >> we get the most propagation possible? > > With Count=0 the solver infers that > (X2 #> X1) #= 0 > i.e. > X2 #=< X1 > > I guess you would like to combine that information with the alldifferent > constraint, and obtain the stronger constraint > > X2 #< X1. > > One way to achieve this propagation could be to use, instead of the #< > /3 constraint, a constraint that excludes the possibility of having X2 = > X1 (i.e., either X1 < X2 or X2 > X1). For example: > > :- lib(propia). > mygt(X,Y,B):- mygt1(X,Y,B) infers most. > mygt1(A,B,1):- A #> B. > mygt1(A,B,0):- A #< B. > > Now this constraint can be used instead of #< /3 : > > ?- N=4, Count=0, L = [X1,X2,X3,X4], length(L, N), L #:: 1..N, > ic_global:alldifferent(L), mygt(X2,X1,B1), M12 #= max([X1,X2]), > mygt(X3,M12,B2), M123 #= max([X1,X2,X3]), mygt(X4,M123,B3), > sumlist([B1,B2,B3]) #= Count. > > N = 4 > Count = 0 > L = [4, X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}] > X1 = 4 > X2 = X2{1 .. 3} > X3 = X3{1 .. 3} > X4 = X4{1 .. 3} > B1 = 0 > M12 = 4 > B2 = 0 > M123 = 4 > B3 = 0 > > > Delayed goals: > mygt1(X2{1 .. 3}, 4, 0) infers most > mygt1(X3{1 .. 3}, 4, 0) infers most > mygt1(X4{1 .. 3}, 4, 0) infers most > alldifferent([X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}], 1) > Yes (0.00s cpu) > > Cheers, > Marco > |
From: Marco G. <mar...@un...> - 2023-02-20 12:25:22
|
Hi, On 20/02/2023 11:27, Panagiotis Stamatopoulos wrote: > Hello Everybody, > > After having loaded libraries ic and ic_global, we give the query: > > ?- N = 4, Count = 0, length(L, N), L #:: 1..N, > ic_global:alldifferent(L), L = [X1,X2,X3,X4], (X2 #> X1) + (X3 #> > max([X1,X2])) + (X4 #> max([X1,X2,X3])) #= Count. > > N = 4 > Count = 0 > L = [X1{1 .. 4}, X2{1 .. 4}, X3{1 .. 4}, X4{1 .. 4}] > X1 = X1{1 .. 4} > X2 = X2{1 .. 4} > X3 = X3{1 .. 4} > X4 = X4{1 .. 4} > There are 6 delayed goals. > Yes (0.00s cpu) > > As we may see, from the query we can infer that X1 = 4. Is there > any alternative way to pose the query in order to get this result? > Note that Count might be anything between 0 and 3 (if we assign it > the value 3, we get the answer X1 = 1, X2 = 2, X3 = 3, X4 = 4, > as we might expect). But what if Count is less than 3? How could > we get the most propagation possible? With Count=0 the solver infers that (X2 #> X1) #= 0 i.e. X2 #=< X1 I guess you would like to combine that information with the alldifferent constraint, and obtain the stronger constraint X2 #< X1. One way to achieve this propagation could be to use, instead of the #< /3 constraint, a constraint that excludes the possibility of having X2 = X1 (i.e., either X1 < X2 or X2 > X1). For example: :- lib(propia). mygt(X,Y,B):- mygt1(X,Y,B) infers most. mygt1(A,B,1):- A #> B. mygt1(A,B,0):- A #< B. Now this constraint can be used instead of #< /3 : ?- N=4, Count=0, L = [X1,X2,X3,X4], length(L, N), L #:: 1..N, ic_global:alldifferent(L), mygt(X2,X1,B1), M12 #= max([X1,X2]), mygt(X3,M12,B2), M123 #= max([X1,X2,X3]), mygt(X4,M123,B3), sumlist([B1,B2,B3]) #= Count. N = 4 Count = 0 L = [4, X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}] X1 = 4 X2 = X2{1 .. 3} X3 = X3{1 .. 3} X4 = X4{1 .. 3} B1 = 0 M12 = 4 B2 = 0 M123 = 4 B3 = 0 Delayed goals: mygt1(X2{1 .. 3}, 4, 0) infers most mygt1(X3{1 .. 3}, 4, 0) infers most mygt1(X4{1 .. 3}, 4, 0) infers most alldifferent([X2{1 .. 3}, X3{1 .. 3}, X4{1 .. 3}], 1) Yes (0.00s cpu) Cheers, Marco -- Marco Gavanelli Coordinator of the courses -L8 Electronics and Computer Science Engineering -LM29 Electronics Engineering for ICT -LM32 Computer Science and Automation Engineering Associate Professor Ph.D. in Computer Science Engineering Dept of Engineering University of Ferrara Tel/Fax +39-0532-97-4833 http://docente.unife.it/marco.gavanelli |
From: Panagiotis S. <ta...@di...> - 2023-02-20 10:41:02
|
Hello Everybody, After having loaded libraries ic and ic_global, we give the query: ?- N = 4, Count = 0, length(L, N), L #:: 1..N, ic_global:alldifferent(L), L = [X1,X2,X3,X4], (X2 #> X1) + (X3 #> max([X1,X2])) + (X4 #> max([X1,X2,X3])) #= Count. N = 4 Count = 0 L = [X1{1 .. 4}, X2{1 .. 4}, X3{1 .. 4}, X4{1 .. 4}] X1 = X1{1 .. 4} X2 = X2{1 .. 4} X3 = X3{1 .. 4} X4 = X4{1 .. 4} There are 6 delayed goals. Yes (0.00s cpu) As we may see, from the query we can infer that X1 = 4. Is there any alternative way to pose the query in order to get this result? Note that Count might be anything between 0 and 3 (if we assign it the value 3, we get the answer X1 = 1, X2 = 2, X3 = 3, X4 = 4, as we might expect). But what if Count is less than 3? How could we get the most propagation possible? Also, note that this is a simplified version of a more general program, where N might be anything and the constraint on the sum of constraints is constructed recursively. Regards, Panagiotis |
From: Thorsten W. <tho...@we...> - 2023-02-06 10:02:25
|
Hi, I found a strange bug with CLP/CBC and ECLiPSe 7.x (incl. 7.1.13). The program below returns a "no", as CLP/CBC seems to think that the problem is infeasible. If a small change is made, e.g., B210 removed from the list of integers, then the solver returns the correct answer "0.0". CPLEX or Xpress do not have a problem. ECLiPSe 6.1 was also fine. Cheers, Thorsten :- lib(eplex). run(D) :- IntVars = [B11,B12,B13,B14,B15,B16,B17,B18,B19,B110, B21,B22,B23,B24,B25,B26,B27,B28,B29,B210], 100 $= C+sum(IntVars), R11 $= B11+B12+B13+B14+B15, R12 $= B16+B17+B18+B19+B110, R21 $= B21+B22+B23+B24+B25, R22 $= B26+B27+B28+B29+B210, R11 $>= 0, R11 $=< 30, R12 $>= 0, R12 $=< 30, R21 $>= 0, R21 $=< 20, R22 $>= 0, R22 $=< 20, C $>= 0, C $=< 100, eplex:integers(IntVars), eplex_solver_setup(min(C), D, [], []), eplex_solve(D). |
From: Paulo M. <pm...@lo...> - 2022-12-20 16:54:40
|
Hi, Logtalk 3.61.0 is now available for downloading at: https://logtalk.org/ This release provides updated for several Prolog backend adapters and integration scripts for use in the Jupyter kernel for Logtalk (https://github.com/LogtalkDotOrg/logtalk-jupyter-kernel); adds a new "ids" library for generating identifiers (Base64 encoded) with parametrizable text representation and number of bytes of randomness; adds new "pairs" library object predicates; adds "packs" tool support for using "git archive" for installing packs, providing a better user experience when the packs registry server uses Single Sign-On (SSO) for authentication; and includes additional tests for library predicates and standard arithmetic functions. For details and a complete list of changes, please consult the release notes at: https://github.com/LogtalkDotOrg/logtalk3/blob/master/RELEASE_NOTES.md You can show your support for Logtalk continued development and success at GitHub by giving us a star and a symbolic sponsorship: https://github.com/LogtalkDotOrg/logtalk3 Happy logtalking! Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer |
From: Joachim S. <jsc...@co...> - 2022-12-18 23:56:28
|
Hi Christophe, After reading Kish's answer, and re-reading your question, I think you are in fact looking for the *breakpoint* facility. This allows you to stop the debugger at a particular line in the code. The documentation may be a bit brief on that. The easiest way to set a breakpoint is with TkEclipse's tracer: * open the tracer * start executing your toplevel goal * the tracer will immediately stop at the first CALL * in the "Source Context" tab, navigate to the source location where you want to stop * to the left of the code you see a gutter with grey # symbols -- these are the locations where you can set a breakpoint * click on the # symbol to enable/disable a breakpoint (enabled ones are red) * click Leap to continue execution * the tracer will stop at the breakpoint Tracer with breakpoint Breakpoints can also be set via the command like, e.g. ?- spy "buggy.ecl":5. breakpoint added to line 5 of file /homes/jschimpf/Playground/buggy.ecl in predicate eclipse : p / 0 Yes (0.00s cpu) Hope that's what you needed, -- Joachim On 15/12/2022 23:44, Kish Shen wrote: > Hi Chris, > > In ECLiPSe, I don't think you can turn on the debugger and trace the execution > starting from there. > However, you can turn on the debugger for a specific goal by wrapping it with > trace/1 or debug.1. Using your example: > > big_goal1, > trace(buggy_goal), > big_goal2. > > If the debugger was off when you run the above query, then only buggy_goal > will be traced. > The difference between trace/1 and debug/1 is that the debugger is in creep > mode for trace/1 and will stop immediately, while debug/1 will only stop for > a predicate with a spy point. > > Running goals with the debugger on is much slower than without the debugger, > so using trace/1 and debug/1 avoids the overhead for goals you are not debugging. > Is this the main reason why you want to trace the execution of buggy_goal? > > If instead you are interested in tracing a specific call to buggy_goal in > your source code, you can set a breakpoint on it in TkECLiPSe's debugger., so > that the debugger will stop only at the call port for that specific call. > > I am surprised that your mytrace/0 worked for you. As far as I can tell, > although mytrace/0 will turn on the debugger, the tracing will not start from > there, but only from your next top-level goal. You don't need to use spy/1 to > turn on the debugger - you can use the debugging flag for set_flag./2, but > this will also not start tracing immediately. > > --Kish > > On Thu, Dec 15, 2022 at 9:42 PM Chris Meudec <Chr...@se...> wrote: > > I am reacquainting myself with ECLiPSe 7.0 after playing with SICSTUS for > a while... > > I SICSTUS I can insert a call to the predicate 'trace' anywhere in my > code, and the debugger will awake and waits for my instructions there. > > In ECLiPSe, trace seems to be a command, not a predicate, so I cannot do > the same. > spy/1 must be applied to a whole predicate so it cannot be used to switch > the debugger in between predicate calls. set_flag/3 also require a predicate > > The best I can do to replicate that behaviour (after an hour of > experimentation!) is to create my own mytrace/0 predicate: > > p:- big_goal1, mytrace, buggy_goal, big_goal2. > > big_goal1. > buggy_goal. > big_goal2. > > mytrace. > :- spy mytrace/0. > > This works as expected: the debugger switches itself on and I can creep > through the rest of the code. > I could not get debug/1 on its own nor with set_flag/3 to work. > > > Is there a better way? > > Thanks, > Chris > -- > Dr Chris Meudec <http://www.echancrure.eu/>(he/him) Maitrise, PhD, MA (T&L) > Lecturer in Software Development > E chr...@se... | *setu.ie* <https://setu.ie/> > turn on images <https://setu.ie/> > > Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland > Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93 > V960, Éire > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > > > > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users |
From: Kish S. <kis...@gm...> - 2022-12-15 23:45:13
|
Hi Chris, In ECLiPSe, I don't think you can turn on the debugger and trace the execution starting from there. However, you can turn on the debugger for a specific goal by wrapping it with trace/1 or debug.1. Using your example: big_goal1, trace(buggy_goal), big_goal2. If the debugger was off when you run the above query, then only buggy_goal will be traced. The difference between trace/1 and debug/1 is that the debugger is in creep mode for trace/1 and will stop immediately, while debug/1 will only stop for a predicate with a spy point. Running goals with the debugger on is much slower than without the debugger, so using trace/1 and debug/1 avoids the overhead for goals you are not debugging. Is this the main reason why you want to trace the execution of buggy_goal? If instead you are interested in tracing a specific call to buggy_goal in your source code, you can set a breakpoint on it in TkECLiPSe's debugger., so that the debugger will stop only at the call port for that specific call. I am surprised that your mytrace/0 worked for you. As far as I can tell, although mytrace/0 will turn on the debugger, the tracing will not start from there, but only from your next top-level goal. You don't need to use spy/1 to turn on the debugger - you can use the debugging flag for set_flag./2, but this will also not start tracing immediately. --Kish On Thu, Dec 15, 2022 at 9:42 PM Chris Meudec <Chr...@se...> wrote: > I am reacquainting myself with ECLiPSe 7.0 after playing with SICSTUS for > a while... > > I SICSTUS I can insert a call to the predicate 'trace' anywhere in my > code, and the debugger will awake and waits for my instructions there. > > In ECLiPSe, trace seems to be a command, not a predicate, so I cannot do > the same. > spy/1 must be applied to a whole predicate so it cannot be used to switch > the debugger in between predicate calls. set_flag/3 also require a > predicate > > The best I can do to replicate that behaviour (after an hour of > experimentation!) is to create my own mytrace/0 predicate: > > p :- big_goal1, mytrace, buggy_goal, big_goal2. > > big_goal1. > buggy_goal. > big_goal2. > > mytrace. > :- spy mytrace/0. > > This works as expected: the debugger switches itself on and I can creep > through the rest of the code. > I could not get debug/1 on its own nor with set_flag/3 to work. > > > Is there a better way? > > Thanks, > Chris > -- > Dr Chris Meudec <http://www.echancrure.eu/> (he/him) Maitrise, PhD, MA > (T&L) > Lecturer in Software Development > E chr...@se... | *setu.ie* <https://setu.ie/> > [image: turn on images] <https://setu.ie/> > > Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland > Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93 > V960, Éire > _______________________________________________ > ECLiPSe-CLP-Users mailing list > ECL...@li... > https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users > |
From: Chris M. <Chr...@se...> - 2022-12-15 15:09:41
|
I am reacquainting myself with ECLiPSe 7.0 after playing with SICSTUS for a while... I SICSTUS I can insert a call to the predicate 'trace' anywhere in my code, and the debugger will awake and waits for my instructions there. In ECLiPSe, trace seems to be a command, not a predicate, so I cannot do the same. spy/1 must be applied to a whole predicate so it cannot be used to switch the debugger in between predicate calls. set_flag/3 also require a predicate The best I can do to replicate that behaviour (after an hour of experimentation!) is to create my own mytrace/0 predicate: p :- big_goal1, mytrace, buggy_goal, big_goal2. big_goal1. buggy_goal. big_goal2. mytrace. :- spy mytrace/0. This works as expected: the debugger switches itself on and I can creep through the rest of the code. I could not get debug/1 on its own nor with set_flag/3 to work. Is there a better way? Thanks, Chris -- Dr Chris Meudec<http://www.echancrure.eu/> (he/him) Maitrise, PhD, MA (T&L) Lecturer in Software Development E chr...@se...<mailto:chr...@se...> | setu.ie<https://setu.ie/> [turn on images]<https://setu.ie/> Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93 V960, Éire |