尝试运行SWI Prolog Simplex示例时出错

时间:2018-05-21 16:18:20

标签: prolog swi-prolog simplex

我正在尝试运行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.

1 个答案:

答案 0 :(得分:4)

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

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