init and friends : cleanup

This commit is contained in:
Vítor Santos Costa
2015-11-05 19:33:38 +00:00
parent 44dc6f06d7
commit f8b5ca8291
7 changed files with 7 additions and 80 deletions

View File

@@ -1,52 +0,0 @@
x2%
% ProbLog extension to use an YAP BDD interface module, instead of simplecudd.
%
:- use_module(library(trie_sp)).
:- use_module(library(bdd)).
:- use_module(library(bhash)).
problog_kbest_bdd(Goal, K, Prob, ok) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob).
problog_kbest_as_bdd(Goal, K, bdd(Dir, Tree, MapList)) :-
problog_kbest_to_bdd(Goal, K, BDD, MapList),
bdd_tree(BDD, bdd(Dir, Tree, _Vars)),
bdd_close(BDD).
problog_kbest_to_bdd(Goal, K, BDD, MapList) :-
problog_flag(first_threshold,InitT),
init_problog_kbest(InitT),
problog_control(off,up),
problog_kbest_id(Goal, K),
retract(current_kbest(_,ListFound,_NumFound)),
build_prefixtree(ListFound),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
delete_ptree(Trie_Completed_Proofs).
problog_fl_bdd(Goal, _) :-
init_problog_low(0.0),
problog_control(off, up),
timer_start(sld_time),
problog_call(Goal),
add_solution,
fail.
problog_fl_bdd(_,Prob) :-
timer_stop(sld_time,SLD_Time),
problog_var_set(sld_time, SLD_Time),
nb_getval(problog_completed_proofs, Trie_Completed_Proofs),
tabled_trie_to_bdd(Trie_Completed_Proofs, BDD, MapList),
bind_maplist(MapList, BoundVars),
bdd_to_probability_sum_product(BDD, BoundVars, Prob),
(problog_flag(retain_tables, true) -> retain_tabling; true),
clear_tabling.
bind_maplist([], []).
bind_maplist([Node-_|MapList], [ProbFact|BoundVars]) :-
get_fact_probability(Node,ProbFact),
bind_maplist(MapList, BoundVars).

View File

@@ -1,7 +0,0 @@
@BDD1
2
0
2
L1 = x0 + x1
L2 = L1
L2

View File

@@ -1,7 +0,0 @@
digraph d{
x0 [label="burglary\nx0", style="filled", color="lightblue"];
x1 [label="earthquake\nx1", style="filled", color="lightblue"];
L3 [label="v",shape="invtriangle", style="filled", color="greenyellow"];
x0 -> L3;
x1 -> L3;
}