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
(1) |
Sep
(2) |
Oct
(1) |
Nov
(1) |
Dec
|
|
From: Paulo M. <pm...@lo...> - 2023-12-12 17:05:17
|
Hi, Logtalk 3.73.0 is now available for downloading at: https://logtalk.org/ This release adds linter warnings for deprecated arithmetic predicates and functions; adds warnings for comparing numbers using unification; adds support for using backend-declared deprecated built-in predicates in linter warnings; improves checking the availability of predicates in "user" for "uses/2" and "use_module/2" directives; avoids false positive linter warnings about non-terminals called as predicates when the caller is a phrase-like predicate declared in the backend adapter file; improves compiler reporting of term-expansion errors; fixes unknown and undefined predicate call warnings when the calls occur in an included file to report the actual location instead of the main file; fixes printing of grammar rules linter warnings to respect the "grammar_rules" flag; adds adapter files support for deprecated built-in predicates and for declaring phrase-like predicates that call non-terminals; improves the Handbook grammar section now uses W3C-style EBNF syntax compatible with the [Railroad Diagram Generator](https://www.bottlecaps.de/rr/ui), also fixing typos and omissions; improves the Handbook section on parametric objects; improves the documentation of the "wrapper" tool; adds an experimental "mutations" library for generating random mutations of terms of selected types (intended for eventual fuzz testing support); adds a "tsv" library for reading and writing TSV files; adds new predicates and non-terminals to the "types", "grammars", and "random" libraries; improves the performance of the "term_io" library predicates; includes updates and fixes to the "lgtunit", "tutor", and "wrapper" tools; fixes the PowerShell documentation scripts to avoid an error when converting XML files; improves the "logtalk_tester" scripts detection and reporting of broken test sets due to backend bugs; adds new "haunted_wasteland", "scratchcards", and "trebuchet" examples (solving Advent of Code 2023 problems); adds new tests, updates, and fixes issues with the "poem", "profiling", "self_vs_this", "errors", "bench", and "benchmarks" examples; adds additional tests for the "phrase/2-3" built-in methods and fixes an issue with a "setof/3" built-in method test; improves the macOS installer; fixes the "logtalk_user_setup.ps1" PowerShell script to use a valid path for the backup directory; and includes portability updates for B-Prolog, CxProlog, ECLiPSe, LVM, and SWI-Prolog. Thanks to Domingo Alvarez Duarte and Yurii Rashkovskii for their contributions to this release. 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: koyahata <koy...@ko...> - 2023-08-09 00:36:16
|
Dear Joachim, Thank you for the detailed answer and I apologize for late reply. I can run DosEclipse with no problem. I checked HKEY_LOCAL_MACHINE\SOFTWARE\IC-Parc\Eclipse\7.1\ECLIPSEDIR is pointing to "C:\Program Files\ECLiPSe 7.1" I found all files you listed in C:\Program Files\ECLiPSe 7.1\lib\x86_64_nt I added new windows account and could run tkeclipse successfully with this account. So this problem seems to come from windows account properties. I added and removed administrator authority into this account and tkeclipse could be run from both. On 2023/08/05 21:49, Joachim Schimpf via ECLiPSe-CLP-Users wrote: > Dear Taku Koyahata, > > I have just tried a fresh installation on a Windows 10 Home version 22H2 > (not Japanese version though) and cannot reproduce the problem. Windows > 11 also works fine. > > Can you start DosEclipse successfully? > > In your registry, you should have an entry > HKEY_LOCAL_MACHINE\SOFTWARE\IC-Parc\Eclipse\7.1\ECLIPSEDIR pointing to > "C:\Program Files\ECLiPSe 7.1" > > and the following DLLs as a result of installing ECLiPSe: > > Directory of C:\Program Files\ECLiPSe 7.1\lib\x86_64_nt > > 24/05/2023 14:14 <DIR> . > 24/05/2023 14:14 <DIR> .. > 01/01/2023 19:07 319,482 bitmap.dll > 01/01/2023 19:07 331,906 dbi_mysql.dll > 01/01/2023 19:06 25,089 eclipse.def > 01/01/2023 19:06 1,411,204 eclipse.dll > 01/01/2023 19:06 96,514 eclipse.dll.a > 01/01/2023 19:06 22,528 eclipse.exe > 01/01/2023 19:07 306,688 ec_java.dll > 01/01/2023 19:07 299,465 ec_java_load.dll > 01/01/2023 19:07 310,236 edge_finder.dll > 01/01/2023 19:07 360,145 eregex.dll > 01/01/2023 19:07 10,295,296 gfd.dll > 01/01/2023 19:07 355,650 ic.dll > 01/01/2023 19:05 2,261 INST_PARAMS > 01/01/2023 19:05 1,073,455 libgmp-10.dll > 01/01/2023 19:05 4,096 Makefile.external > 01/01/2023 19:06 6,021,120 seosiclpcbc.dll > 01/01/2023 19:06 316,015 tkeclipse.dll > 01/01/2023 19:06 130 tkexdr.def > 01/01/2023 19:06 312,016 tkexdr.dll > 01/01/2023 19:06 2,006 tkexdr.dll.a > 20 File(s) 21,865,302 bytes > > The error message isn't very specific, it might be a permission problem > or your particular virus scanner causing trouble. > > Regards, > Joachim > > > On 31/07/2023 09:01, koyahata wrote: >> I downloaded ECLiPSe_7.1_13_x86_64_nt.exe from the path below >> https://eclipseclp.org/Distribution/Builds/7.1_13/x86_64_nt/ . >> After downloading and installing ECLiPSe, running tkeclipse cause the >> caution below: >> >> ------------ >> couldn't initialize ECLiPSe while executing "ec_init_" >> (procedure "ec_init" line 7) >> invoked from within >> "ec_init" >> (file "C:\Program Files\ECLiPSe 7.1\lib_tcl\tkeclipse.tcl" line 1124. >> ------------- >> >> After this caution occurs, It cannot continue anymore. >> I'm using Windows 10 Home version 22H2. >> >> Does anyone have any suggestions to fix this problem? >> Any help will be appreciated. >> >> Regards, >> Taku Koyahata >> >> >> _______________________________________________ >> 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: Joachim S. <jsc...@co...> - 2023-08-05 13:06:43
|
Dear Taku Koyahata,
I have just tried a fresh installation on a Windows 10 Home version 22H2 (not Japanese version
though) and cannot reproduce the problem. Windows 11 also works fine.
Can you start DosEclipse successfully?
In your registry, you should have an entry
HKEY_LOCAL_MACHINE\SOFTWARE\IC-Parc\Eclipse\7.1\ECLIPSEDIR pointing to "C:\Program Files\ECLiPSe 7.1"
and the following DLLs as a result of installing ECLiPSe:
Directory of C:\Program Files\ECLiPSe 7.1\lib\x86_64_nt
24/05/2023 14:14 <DIR> .
24/05/2023 14:14 <DIR> ..
01/01/2023 19:07 319,482 bitmap.dll
01/01/2023 19:07 331,906 dbi_mysql.dll
01/01/2023 19:06 25,089 eclipse.def
01/01/2023 19:06 1,411,204 eclipse.dll
01/01/2023 19:06 96,514 eclipse.dll.a
01/01/2023 19:06 22,528 eclipse.exe
01/01/2023 19:07 306,688 ec_java.dll
01/01/2023 19:07 299,465 ec_java_load.dll
01/01/2023 19:07 310,236 edge_finder.dll
01/01/2023 19:07 360,145 eregex.dll
01/01/2023 19:07 10,295,296 gfd.dll
01/01/2023 19:07 355,650 ic.dll
01/01/2023 19:05 2,261 INST_PARAMS
01/01/2023 19:05 1,073,455 libgmp-10.dll
01/01/2023 19:05 4,096 Makefile.external
01/01/2023 19:06 6,021,120 seosiclpcbc.dll
01/01/2023 19:06 316,015 tkeclipse.dll
01/01/2023 19:06 130 tkexdr.def
01/01/2023 19:06 312,016 tkexdr.dll
01/01/2023 19:06 2,006 tkexdr.dll.a
20 File(s) 21,865,302 bytes
The error message isn't very specific, it might be a permission problem or your particular virus
scanner causing trouble.
Regards,
Joachim
On 31/07/2023 09:01, koyahata wrote:
> I downloaded ECLiPSe_7.1_13_x86_64_nt.exe from the path below
> https://eclipseclp.org/Distribution/Builds/7.1_13/x86_64_nt/ .
> After downloading and installing ECLiPSe, running tkeclipse cause the caution below:
>
> ------------
> couldn't initialize ECLiPSe while executing "ec_init_"
> (procedure "ec_init" line 7)
> invoked from within
> "ec_init"
> (file "C:\Program Files\ECLiPSe 7.1\lib_tcl\tkeclipse.tcl" line 1124.
> -------------
>
> After this caution occurs, It cannot continue anymore.
> I'm using Windows 10 Home version 22H2.
>
> Does anyone have any suggestions to fix this problem?
> Any help will be appreciated.
>
> Regards,
> Taku Koyahata
>
>
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECL...@li...
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
|
|
From: koyahata <koy...@ko...> - 2023-07-31 08:27:39
|
I downloaded ECLiPSe_7.1_13_x86_64_nt.exe from the path below https://eclipseclp.org/Distribution/Builds/7.1_13/x86_64_nt/ . After downloading and installing ECLiPSe, running tkeclipse cause the caution below: ------------ couldn't initialize ECLiPSe while executing "ec_init_" (procedure "ec_init" line 7) invoked from within "ec_init" (file "C:\Program Files\ECLiPSe 7.1\lib_tcl\tkeclipse.tcl" line 1124. ------------- After this caution occurs, It cannot continue anymore. I'm using Windows 10 Home version 22H2. Does anyone have any suggestions to fix this problem? Any help will be appreciated. Regards, Taku Koyahata |
|
From: Mikhail S. <sou...@gm...> - 2023-06-21 22:47:36
|
Greetings,
If you are interested in modern heuristic Automated Planning, then
you will be pleased to learn that it can be done with PROLOG. I would like
to inform you about a recent deductive planner TPLH implemented in ECLiPSe
PROLOG. TPLH is described in the paper
Planning as Theorem Proving with Heuristics
Mikhail Soutchanski, Ryan Young
https://arxiv.org/abs/2303.13638
Abstract
Planning as a theorem proving in situation calculus was abandoned
50 years ago as an impossible project. But we have developed a Theorem
Proving Lifted Heuristic (TPLH) planner that searches for a plan in a tree
of situations using the A* search algorithm. It is controlled by a delete
relaxation-based domain independent heuristic. We compare TPLH with the
state-of-the-art Fast Downward (FD) and Best First Width Search
(BFWS) planners over several standard benchmarks. Since our implementation
of the heuristic function is not optimized, TPLH is slower than FD and
BFWS. But it computes shorter plans, and it explores fewer states. We
discuss previous research on planning within KRR and identify related
directions. Thus we show that deductive lifted heuristic planning in
situation calculus is actually doable.
Comments are welcome. I would be glad to collaborate on a related research
project.
Thanks,
============================================================
Mikhail Soutchanski, Ph.D., Professor
WWW: http://www.cs.torontomu.ca/mes
Department of Computer Science, #ENG275
Faculty of Science
Toronto Metropolitan (formerly Ryerson) University
245 Church Street
Toronto, Ontario,
M5B 2K3, Canada
============================================================
|
|
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
|