Closed hakank closed 4 years ago
The reason is that mc_sample/4 has this signature
mc_sample(:Query:atom,+Samples:int,-Probability:float, Options:list) is det
so you are passing [H,V]
for the probability.
You should use
mc_sample_arg(is_long(H,G),10,[G,H],V).
Thanks for identifying why the query is false.
But why is there an error when running the query the second time?
Because the query asserts stuff in the database, if it fails midway it does not remove the temporary asserted stuff as it would if completed
Ah, OK now I understand.
Thanks.
The following model (also here: http://cplint.eu/p/strange_error_in_mc_for_swipl_8_1_14.pl ) returns a strange error in SWI-Prolog version 8.1.14 (on Linux Ubuntu 18.04.03LTS) and is installed using apt's PPA.
(Yes, it's a silly program. :-) )
Running this query the first time in the SWI-Prolog shell version 8.1.14
?- mc_sample(is_long(H,G),10,[G,H],V).
it returns false.
However, running the query a second next time (in the same shell session) it throws the following: """ ERROR: Type error:
Exception: (12) mcintyre:save_samples(user, is_long(A, B)) ? creep
"""
db_reference' expected, found
user:sampled(0,[],182.02406802989248)' (a compound) ERROR: In: ERROR: [13] erase(user:sampled(0,[],182.02406802989248)) ERROR: [12] mcintyre:save_samples(user,is_long(A,B)) at /home/hakank/lib/swipl/pack/cplint/prolog/mcintyre.pl:309 ERROR: [11] mcintyre:mc_sample(user:is_long(_8908,_8910),10,_8894,_8896,[_8914,_8920]) at /home/hakank/lib/swipl/pack/cplint/prolog/mcintyre.pl:571 ERROR: [10] mcintyre:mc_sample(user:is_long(_8968,_8970),10,[_8974,_8980],[successes(_8992),...|_8998]) at /home/hakank/lib/swipl/pack/cplint/prolog/mcintyre.pl:544 ERROR: [9]The SWI-Prolog version running the SWISH server (version 8.1.8-36-g91fd6bda8) don't have this problem, it returns false every time.
I have updated all the relevant libraries: