SWI-Prolog/swish

Error in example: diabetes

Closed this issue · 3 comments

http://cplint.ml.unife.it/example/inference/diabetes.swinb

?-mc_mh_sample(dm,e,10000,Prob).
Unknown message: type_error({_1594=:=0.6+0.97.370223692711649+0.5089442884782855},1,'a constraint',_1594=:=0.6+0.97.370223692711649+0.5089442884782855)

The error is appearing since the latest updates of swipl. I tried adding

:- multifile sandbox:safe_primitive/1.

safe_primitive({_}).

to swish.pl but it doesn't work.

to swish.pl but it doesn't work.

It is not a sandbox error. A bit of searching shows that {}/1 is not considered a swi_builtin/1 in cplint_util.pl. I guess that is because something looks up {}/1 before library(clp/clpr) is loaded. As this is not an autoload library as well it comes in the cache as not being a built-in.

I propose explicitly loading the libraries on which this analysis is based by adding this above builtin_int/1 in cplint_util.pl:

:- use_module(library(lists)).
:- use_module(library(apply)).
:- use_module(library(clp/clpr)).
:- use_module(library(matrix)).
:- use_module(library(clpfd)).

Thanks Jan! That was the problem, the example now works.