2012-05-23 14:56:01 +01:00
|
|
|
:- use_module(library(pfl)).
|
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
%:- set_solver(ve).
|
2013-01-10 23:02:34 +00:00
|
|
|
%:- set_solver(hve).
|
2012-12-11 23:06:09 +00:00
|
|
|
%:- set_solver(jt).
|
|
|
|
%:- set_solver(bdd).
|
2012-05-23 17:17:50 +01:00
|
|
|
%:- set_solver(bp).
|
|
|
|
%:- set_solver(cbp).
|
2012-12-11 23:06:09 +00:00
|
|
|
%:- set_solver(gibbs).
|
|
|
|
%:- set_solver(lve).
|
|
|
|
%:- set_solver(lkc).
|
|
|
|
%:- set_solver(lbp).
|
|
|
|
|
|
|
|
bayes burglary ; burglary_table ; [].
|
|
|
|
|
|
|
|
bayes earthquake ; earthquake_table ; [].
|
|
|
|
|
|
|
|
bayes alarm, burglary, earthquake ; alarm_table ; [].
|
|
|
|
|
|
|
|
bayes john_calls, alarm ; john_calls_table ; [].
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
bayes mary_calls, alarm ; mary_calls_table ; [].
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
burglary_table(
|
|
|
|
[ 0.001,
|
|
|
|
0.999 ]).
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
earthquake_table(
|
|
|
|
[ 0.002,
|
|
|
|
0.998 ]).
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
alarm_table(
|
|
|
|
[ 0.95, 0.94, 0.29, 0.001,
|
|
|
|
0.05, 0.06, 0.71, 0.999 ]).
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
john_calls_table(
|
|
|
|
[ 0.9, 0.05,
|
|
|
|
0.1, 0.95 ]).
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-11 23:06:09 +00:00
|
|
|
mary_calls_table(
|
|
|
|
[ 0.7, 0.01,
|
|
|
|
0.3, 0.99 ]).
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-06-19 21:19:02 +01:00
|
|
|
% ?- john_calls(J), mary_calls(t).
|
2012-05-23 14:56:01 +01:00
|
|
|
|