/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.
/* Jekejeke Prolog 1.5.4 */https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.
?- time((modular([15,16], X, Y, Z), fail; true)).
% Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
true.
Mostowski Collapse <burs...@gmail.com> writes:--- Synchronet 3.20a-Linux NewsLink 1.114
/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.
With the newly release Scryer Prolog version 0.9.2, I now get:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)). % CPU time: 41.658s
true.
On my machine, that's within a factor of 6 of SWI. That's quite
comparable to many other applications when it comes to time performance:
At the current state of Scryer Prolog development, its performance tends
to be within an order of magnitude of SWI's.
One neat feature of the Scryer Prolog toplevel is that we can press "a"
to obtain *all* solutions, one after the other. In this case:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
% CPU time: 16.080s
X = 52, Y = 216, Z = 217
; % CPU time: 25.942s
X = 216, Y = 52, Z = 217
; % CPU time: 0.250s
false.
It's often nice to get the Prolog system to enumerate all solutions automatically. The GNU Prolog toplevel also has this feature, and I
highly recommend adding it in system where it is not yet available.
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
One motivation to look at the problem, and to look at the--- Synchronet 3.20a-Linux NewsLink 1.114
easier problem with 9 instead 42, is to elaborate a completely
new CLP(FD) solver, that is based on Chinese Remainder Theorem.
Actually I have already a prototype working, the timing was
also already published around 12 months ago. My system was much
faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2: Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
/* Jekejeke Prolog 1.5.4 */
?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.
?- time((modular([15,16], X, Y, Z), fail; true)).https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
% Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
true.
So these 594 ms are 10x times faster than the 5.117 seconds from
SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
the 41.658s from Scryer Prolog. But I didn't yet publish this new
CLP(FD) solver, maybe I did some blogging and also some code
went into comp.lang.prolog here, but its not currently some officially released module somewhere. Its also a solver which isn't based on
attributed variables per se. It requires that the constraint store is re-evaluated with different moduli, so I envision something totally
new, that drops attributed variables, but nevertheless has a constraint
store. Attributed variables have become less important. The dis-
advantage of not having attributed variables would be that the
constraints cannot be used on ordinary predicates. I have no solution
for the later problem yet, but the figures in the former testing show,
that the method can be much much faster than ordinary CLP(FD).
Markus Triska schrieb am Donnerstag, 31. August 2023 um 21:20:14 UTC+2:
Mostowski Collapse <burs...@gmail.com> writes:
/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.
With the newly release Scryer Prolog version 0.9.2, I now get:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 41.658s
true.
On my machine, that's within a factor of 6 of SWI. That's quite
comparable to many other applications when it comes to time performance: At the current state of Scryer Prolog development, its performance tends to be within an order of magnitude of SWI's.
One neat feature of the Scryer Prolog toplevel is that we can press "a"
to obtain *all* solutions, one after the other. In this case:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
% CPU time: 16.080s
X = 52, Y = 216, Z = 217
; % CPU time: 25.942s
X = 216, Y = 52, Z = 217
; % CPU time: 0.250s
false.
It's often nice to get the Prolog system to enumerate all solutions automatically. The GNU Prolog toplevel also has this feature, and I
highly recommend adding it in system where it is not yet available.
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
Whats the Scryer Performance of this Example?
/* GNU Prolog 1.5.0 */
?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
(94 ms) yes
/* SWI-Prolog 9.1.14 */
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips) true.
Mild Shock <burs...@gmail.com> writes:--- Synchronet 3.20a-Linux NewsLink 1.114
Whats the Scryer Performance of this Example?
/* GNU Prolog 1.5.0 */
?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
(94 ms) yes
/* SWI-Prolog 9.1.14 */With Scryer Prolog 0.9.2 on my machine, I get:
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
true.
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), false; true)).
% CPU time: 84.182s
true.
On my machine, that's ca. 15 times slower than SWI 8.3.15, which is the
last SWI version I found installed on this machine. Newer versions may
well be faster! For best performance, I recommend to build Scryer Prolog with the optional --release flag, i.e.:
$ cargo build --release
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
I am also slower than SWI-Prolog with formerly Jekejeke Prolog,--- Synchronet 3.20a-Linux NewsLink 1.114
but sandwhich between Scryer Prolog and SWI-Prolog for this example.
I never know whether my CLP(FD) still works, so first some sanity checks:
?- nth_member(X, [5,4,6], 4).
X = 2;
fail.
?- nth_member(2, [5,4,6], X).
X = 4;
fail.
Then the benchmark results:
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)).
% Time 48513 ms, GC 373 ms, Wall 04/09/2023 21:41
true.
But I don't know whether its comparable with Scryer Prolog since
I didn't test Scryer Prolog, and the Scryer Prolog figures are from
Markus Triskas machine.
I am currently phasing out formerly Jekejeke Prolog. It should receive
the same core as Dogelog Player. And then maybe can also re-add
CLP(FD) and see what happens. But this might take months. Especially
since I want to reinvent CLP(FD), adding some CRA Strategy, and I
don't know yet eactly how to do it. I could optimized the non-labeling behaviour exactly towards this test case, where GNU Prolog performs well. Markus Triska schrieb am Montag, 4. September 2023 um 19:42:01 UTC+2:
Mild Shock <burs...@gmail.com> writes:
Whats the Scryer Performance of this Example?
/* GNU Prolog 1.5.0 */
?- between(1,200,N), length(L,N), nth_member(I,L,E), fail; true.
(94 ms) yes
/* SWI-Prolog 9.1.14 */With Scryer Prolog 0.9.2 on my machine, I get:
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), fail; true)). % 94,504,524 inferences, 4.766 CPU in 4.767 seconds (100% CPU, 19830457 Lips)
true.
?- time((between(1,200,N), length(L,N), nth_member(I,L,E), false; true)). % CPU time: 84.182s
true.
On my machine, that's ca. 15 times slower than SWI 8.3.15, which is the last SWI version I found installed on this machine. Newer versions may well be faster! For best performance, I recommend to build Scryer Prolog with the optional --release flag, i.e.:
$ cargo build --release
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
One motivation to look at the problem, and to look at the--- Synchronet 3.20a-Linux NewsLink 1.114
easier problem with 9 instead 42, is to elaborate a completely
new CLP(FD) solver, that is based on Chinese Remainder Theorem.
Actually I have already a prototype working, the timing was
also already published around 12 months ago. My system was much
faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2: Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
/* Jekejeke Prolog 1.5.4 */
?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.
?- time((modular([15,16], X, Y, Z), fail; true)).https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
% Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
true.
So these 594 ms are 10x times faster than the 5.117 seconds from
SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
the 41.658s from Scryer Prolog. But I didn't yet publish this new
CLP(FD) solver, maybe I did some blogging and also some code
went into comp.lang.prolog here, but its not currently some officially released module somewhere. Its also a solver which isn't based on
attributed variables per se. It requires that the constraint store is re-evaluated with different moduli, so I envision something totally
new, that drops attributed variables, but nevertheless has a constraint
store. Attributed variables have become less important. The dis-
advantage of not having attributed variables would be that the
constraints cannot be used on ordinary predicates. I have no solution
for the later problem yet, but the figures in the former testing show,
that the method can be much much faster than ordinary CLP(FD).
Markus Triska schrieb am Donnerstag, 31. August 2023 um 21:20:14 UTC+2:
Mostowski Collapse <burs...@gmail.com> writes:
/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.
With the newly release Scryer Prolog version 0.9.2, I now get:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 41.658s
true.
On my machine, that's within a factor of 6 of SWI. That's quite
comparable to many other applications when it comes to time performance: At the current state of Scryer Prolog development, its performance tends to be within an order of magnitude of SWI's.
One neat feature of the Scryer Prolog toplevel is that we can press "a"
to obtain *all* solutions, one after the other. In this case:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
% CPU time: 16.080s
X = 52, Y = 216, Z = 217
; % CPU time: 25.942s
X = 216, Y = 52, Z = 217
; % CPU time: 0.250s
false.
It's often nice to get the Prolog system to enumerate all solutions automatically. The GNU Prolog toplevel also has this feature, and I
highly recommend adding it in system where it is not yet available.
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
What speed-up could a N-qubit quantum computer give--- Synchronet 3.20a-Linux NewsLink 1.114
to this problem, find a positive integer tripple (x,y,z) such that:
x^3 + y^3 + 42 = z^3
Mild Shock schrieb am Freitag, 1. September 2023 um 20:47:06 UTC+2:
One motivation to look at the problem, and to look at the
easier problem with 9 instead 42, is to elaborate a completely
new CLP(FD) solver, that is based on Chinese Remainder Theorem.
Actually I have already a prototype working, the timing was
also already published around 12 months ago. My system was much
faster than SWI-Prolog, since SWI-Prolog is slow with smallints and (^)/2: Mostowski Collapse schrieb am Dienstag, 20. September 2022 um 20:28:33 UTC+2:
/* Jekejeke Prolog 1.5.4 */
?- modular([15,16], X, Y, Z).
X = 216, Y = 52, Z = 217;
X = 52, Y = 216, Z = 217;
fail.
?- time((modular([15,16], X, Y, Z), fail; true)).https://groups.google.com/g/comp.lang.prolog/c/mjpxkE3xVYk/m/cn0FICAQAAAJ
% Threads 594 ms, GC 5 ms, Up 591 ms (Current 09/20/22 20:21:30)
true.
So these 594 ms are 10x times faster than the 5.117 seconds from SWI-Prolog using ordinary CLP(FD). And around 100x times faster than
the 41.658s from Scryer Prolog. But I didn't yet publish this new
CLP(FD) solver, maybe I did some blogging and also some code
went into comp.lang.prolog here, but its not currently some officially released module somewhere. Its also a solver which isn't based on
attributed variables per se. It requires that the constraint store is re-evaluated with different moduli, so I envision something totally
new, that drops attributed variables, but nevertheless has a constraint
store. Attributed variables have become less important. The dis-
advantage of not having attributed variables would be that the
constraints cannot be used on ordinary predicates. I have no solution
for the later problem yet, but the figures in the former testing show, that the method can be much much faster than ordinary CLP(FD).
Markus Triska schrieb am Donnerstag, 31. August 2023 um 21:20:14 UTC+2:
Mostowski Collapse <burs...@gmail.com> writes:
/* Scryer Prolog CLP(Z) */
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 75.667s
true.
With the newly release Scryer Prolog version 0.9.2, I now get:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]), fail; true)).
% CPU time: 41.658s
true.
On my machine, that's within a factor of 6 of SWI. That's quite comparable to many other applications when it comes to time performance: At the current state of Scryer Prolog development, its performance tends to be within an order of magnitude of SWI's.
One neat feature of the Scryer Prolog toplevel is that we can press "a" to obtain *all* solutions, one after the other. In this case:
?- time(([X,Y,Z] ins 0..239, X^3+Y^3+9 #= Z^3, label([X,Y,Z]))).
% CPU time: 16.080s
X = 52, Y = 216, Z = 217
; % CPU time: 25.942s
X = 216, Y = 52, Z = 217
; % CPU time: 0.250s
false.
It's often nice to get the Prolog system to enumerate all solutions automatically. The GNU Prolog toplevel also has this feature, and I highly recommend adding it in system where it is not yet available.
All the best,
Markus
--
comp.lang.prolog FAQ: http://www.logic.at/prolog/faq/
The Power of Prolog: https://www.metalevel.at/prolog
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 919 |
Nodes: | 10 (1 / 9) |
Uptime: | 69:15:17 |
Calls: | 12,185 |
Files: | 186,526 |
Messages: | 2,236,663 |