Mostowski Collapse
unread,Sep 28, 2021, 5:27:33 AM9/28/21You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
There is some problem with CLP(FD), that its rather random when it performs
well and when it doesn't perform well. Recently I benchmarked the
SEND+MORE=MONEY problem, and SWI-Prolog exceeds it:
/* SWI-Prolog 8.3.29 */
?- time(puzzle(X)).
% 7,170 inferences, 0.000 CPU in 0.000 seconds (?% CPU, Infinite Lips)
X = [9, 5, 6, 7, 1, 0, 8, 2] ;
% 1,974 inferences, 0.000 CPU in 0.000 seconds (?% CPU, Infinite Lips)
false.
/* Jekejeke Prolog 1.5.1 */
?- time(puzzle(X)).
% Up 136 ms, GC 4 ms, Threads 125 ms (Current 09/28/21 11:23:48)
X = [9, 5, 6, 7, 1, 0, 8, 2] ;
% Up 117 ms, GC 0 ms, Threads 109 ms (Current 09/28/21 11:23:49)
No
Then I benchmarked some Sudoku Problem, and the picture was totally
different. SWI-Prolog had really some problems, but Jekejeke Prolog
did it a little better. I got these results:
example(#(#(_, _, _, _, _, _, _, 1, _),
#(4, _, _, _, _, _, _, _, _),
#(_, 2, _, _, _, _, _, _, _),
#(_, _, _, _, 5, _, 4, _, 7),
#(_, _, 8, _, _, _, 3, _, _),
#(_, _, 1, _, 9, _, _, _, _),
#(3, _, _, 4, _, _, 2, _, _),
#(_, 5, _, 1, _, _, _, _, _),
#(_, _, _, 8, _, 6, _, _, _))).
/* SWI-Prolog, 8.3.29 */
?- time((example(X), sudoku(X))).
91,418,214 inferences, 4.688 CPU in 4.687 seconds (100% CPU, 19502552 Lips)
X = #(#(6, 9, 3, 7, 8, 4, 5, 1, 2),
#(4, 8, 7, 5, 1, 2, 9, 3, 6),
#(1, 2, 5, 9, 6, 3, 8, 7, 4),
#(9, 3, 2, 6, 5, 1, 4, 8, 7),
#(5, 6, 8, 2, 4, 7, 3, 9, 1),
#(7, 4, 1, 3, 9, 8, 6, 2, 5),
#(3, 1, 9, 4, 7, 5, 2, 6, 8),
#(8, 5, 6, 1, 2, 9, 7, 4, 3),
#(2, 7, 4, 8, 3, 6, 1, 5, 9)) ;
231,774,769 inferences, 13.250 CPU in 13.246 seconds (100% CPU, 17492435 Lips)
/* Jekejeke Prolog, 1.5.1 */
?- time((example(X), sudoku(X))).
% Up 2,418 ms, GC 24 ms, Threads 2,406 ms (Current 09/24/21 23:15:48)
X = #(#(6, 9, 3, 7, 8, 4, 5, 1, 2),
#(4, 8, 7, 5, 1, 2, 9, 3, 6),
#(1, 2, 5, 9, 6, 3, 8, 7, 4),
#(9, 3, 2, 6, 5, 1, 4, 8, 7),
#(5, 6, 8, 2, 4, 7, 3, 9, 1),
#(7, 4, 1, 3, 9, 8, 6, 2, 5),
#(3, 1, 9, 4, 7, 5, 2, 6, 8),
#(8, 5, 6, 1, 2, 9, 7, 4, 3),
#(2, 7, 4, 8, 3, 6, 1, 5, 9)) ;
% Up 710 ms, GC 7 ms, Threads 719 ms (Current 09/24/21 23:15:53)