3

我正在尝试运行 SWI-Prolog 的 simplex 库文档中给出的硬币示例,但我收到了以下错误消息:

$ rlwrap swipl coins.pl
Warning: /home/vitorferraz/junk/coins.pl:1:
Unknown message: simlpex(bounded)
Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

1 ?- coins(S), variable_value(S, c(1), C1), variable_value(S, c(5), C5), variable_value(S, c(20), C20).
ERROR: Arithmetic: `rationalize/1' is not a function
ERROR: In:
ERROR:   [13] _5574 is rationalize(111)
ERROR:   [12] simplex:constraint_(0,[...|...]=111,state(0,[],[],[]),_5616) at /usr/local/lib/swipl-7.6.4/library/clp/simplex.pl:636
ERROR:   [10] coins(state(0,[],[],[]),_5664) at /home/vitor/coins.pl:8
ERROR:    [8] '<meta-call>'(user:(...,...)) <foreign>
ERROR:    [7] <user>
ERROR: 
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
4

1 回答 1

4

这表明您已编译 SWI-Prolog ,但不支持 GMP,即 GNU 多精度算术库。

必须使用 GMP 编译 SWI-Prolog 才能使用library(simplex),因为它需要支持有理数

于 2018-05-21T16:22:56.397 回答