Nп/п : 54 из 87
 От   : Markus Triska                       2:5075/128        31 авг 23 21:26:55
 К    : Mostowski Collapse                                    31 авг 23 22:21:02
 Тема : Re: Autum Challenge, 42 is the Answer
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <m2r0njgghs.fsf@logic.at> 0426d38c
@REPLY:
<868d4f75-c293-4929-83b7-e319f4dba451n@googlegroups.com> 3d79301a
@REPLYADDR Markus Triska <triska@logic.at>
@REPLYTO 2:5075/128 Markus Triska
@CHRS: CP866 2
@RFC: 1 0
<f4ad7701-cae3-4513-8b8e-a483415c6ad8@googlegroups.com><977d5e9f-469f-4516-9260-
26e917bbec2cn@googlegroups.com><142ae65f-61ad-403e-8450-caebfddf6d0an@googlegrou
ps.com><4e9bf208-0882-4f63-b243-b434f0a1392cn@googlegroups.com><3a23c78d-d4a1-47
2a-a460-776a5ca7d3een@googlegroups.com> oglegroups.com><030ed934-efa4-4a1e-96b4-96f9c5214a6en@googlegroups.com> -2c33-42f6-9630-2828418aa146n@googlegroups.com><868d4f75-c293-4929-83b7-e319f4db
a451n@googlegroups.com>
@RFC-Message-ID: <m2r0njgghs.fsf@logic.at>
@TZUTC: 0200
@PID: Emacs/27.0.50
@TID: FIDOGATE-5.12-ge4e8b94
Mostowski Collapse <bursejan@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
--- Emacs/27.0.50
 * Origin: man (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх