CLPBN: query variables may have static evidence.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1235 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-01-15 05:40:38 +00:00
parent baf823eb5c
commit be638d705c
2 changed files with 8 additions and 8 deletions

View File

@ -23,7 +23,7 @@
:- multifile
user:term_expansion/2.
:- attribute key/1, dist/3, evidence/1, done/1, starter/0.
:- attribute key/1, dist/3, evidence/1, starter/0.
:- use_module('clpbn/bnt', [dump_as_bnt/2,

View File

@ -60,7 +60,8 @@ do_vel(LVs,Vs0,AllDiffs) :-
%
get_rid_of_ev_vars([],[]).
get_rid_of_ev_vars([V|LVs0],LVs) :-
clpbn:get_atts(V, [evidence(_)]), !,
clpbn:get_atts(V, [evidence(Ev)]), !,
put_atts(V, [posterior([],Ev,[],[])]), !,
get_rid_of_ev_vars(LVs0,LVs).
get_rid_of_ev_vars([V|LVs0],[V|LVs]) :-
get_rid_of_ev_vars(LVs0,LVs).
@ -387,17 +388,16 @@ divide_by_sum([P|Ps0],Sum,[PN|Ps]) :-
%
attribute_goal(V, G) :-
get_atts(V, [posterior(Vs,Vals,Ps,AllDiffs)]), !,
massage_out(Vs, Vals, Ps, G, AllDiffs).
attribute_goal(V, true) :-
get_atts(V, [evidence(Ev)]), Ev = V.
massage_out(Vs, Vals, Ps, G, AllDiffs, V).
massage_out(Vs, [D], [P], p(CEqs)=P, AllDiffs) :- !,
massage_out([], Ev, _, V=Ev, _, V) :- !.
massage_out(Vs, [D], [P], p(CEqs)=P, AllDiffs, _) :- !,
gen_eqs(Vs,D,Eqs),
add_alldiffs(AllDiffs,Eqs,CEqs).
massage_out(Vs, [D|Ds], [P|Ps], (p(CEqs)=P,G) , AllDiffs) :-
massage_out(Vs, [D|Ds], [P|Ps], (p(CEqs)=P,G) , AllDiffs, V) :-
gen_eqs(Vs,D,Eqs),
add_alldiffs(AllDiffs,Eqs,CEqs),
massage_out(Vs, Ds, Ps, G, AllDiffs).
massage_out(Vs, Ds, Ps, G, AllDiffs, V).
gen_eqs([V], [D], (V=D)) :- !.
gen_eqs([V], D, (V=D)) :- !.