handle repeated query vars with evidence

This commit is contained in:
Vitor Santos Costa 2013-01-09 17:49:07 +00:00
parent ff953eb20a
commit 46fbc539bf
1 changed files with 16 additions and 0 deletions

View File

@ -390,6 +390,9 @@ call_ground_solver(Solver, GVars, _GoalKeys, Keys, Factors, Evidence) :-
% do nothing if we don't have query variables to compute.
write_out(_, GVars, AVars, _) :-
maplist(bound_varl(AVars), GVars), !.
write_out(_, [], _, _) :- !.
write_out(graphs, _, AVars, _) :- !,
@ -426,6 +429,19 @@ write_out(Solver, _, _, _) :-
format("Error: solver '~w' is unknown.", [Solver]),
fail.
bound_varl(AVars, L) :-
maplist(bound_var(AVars), L).
bound_var(_AVars,V) :-
var(V), !,
get_atts(V, [key(K)]),
( pfl:evidence(K, Ev) -> true ; get_atts(V, [key(K), evidence(Ev)]) ),
pfl:skolem(K,D),
once(nth0(Ev,D,V)).
bound_var(_AVars, _V).
%
% convert a PFL network (without constraints)
% into CLP(BN) for evaluation