From 8ca147719f11a800c815cc2fde7229cbd3044ac6 Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Fri, 16 Sep 2011 15:48:43 +0100 Subject: [PATCH 1/5] fix clause added at each step. --- packages/CLPBN/learning/aleph_params.yap | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/CLPBN/learning/aleph_params.yap b/packages/CLPBN/learning/aleph_params.yap index 91f7b39cd..ea49bc0c3 100644 --- a/packages/CLPBN/learning/aleph_params.yap +++ b/packages/CLPBN/learning/aleph_params.yap @@ -128,9 +128,12 @@ store_cl(Cl) :- add_new_clause(_,(_ :- true),_,_) :- !. add_new_clause(_,(H :- B),_,_) :- +%trace, % user:db_usage, % user:db_dynamic, domain(H, K, V, D), + user:cost((H :- B), _, Cost), + format(user_error,'Current Cost: ~w.~n', [Cost]), rewrite_body(B, IB, Vs, _, ( !, { V = K with p(D, CPTList, Vs) })), % need to remember which CPT we want get_dist_key(Id, K), From abf74a8aa972b2bfac7514515f3a9a3b7e0034c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 20 Sep 2011 09:53:06 +0100 Subject: [PATCH 2/5] avoid unnecessart work. --- C/attvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C/attvar.c b/C/attvar.c index cdd9a327d..63ac3377d 100644 --- a/C/attvar.c +++ b/C/attvar.c @@ -897,7 +897,7 @@ AllAttVars( USES_REGS1 ) { CELL *pt = H0; CELL *myH = H; - while (pt < H) { + while (pt < myH) { switch(*pt) { case (CELL)FunctorAttVar: if (IsUnboundVar(pt+1)) { From 7cc1d9807999289f1875f9cf86c3c99b71fd9081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 20 Sep 2011 09:53:43 +0100 Subject: [PATCH 3/5] fix bug with incremental gc setting HZ incorrectly. --- C/heapgc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C/heapgc.c b/C/heapgc.c index bc437b076..0dff8c688 100644 --- a/C/heapgc.c +++ b/C/heapgc.c @@ -3696,6 +3696,11 @@ compaction_phase(tr_fr_ptr old_TR, CELL *current_env, yamop *curp USES_REGS) } if (CurrentH0) { H0 = CurrentH0; +#ifdef TABLING + /* make sure that we have the correct H_FZ if we're not tabling */ + if (B_FZ == (choiceptr)LCL0) + H_FZ = H0; +#endif /* TABLING */ } } From bfc1def1d55396268be3fbdb03e117a0610b5d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 20 Sep 2011 09:54:30 +0100 Subject: [PATCH 4/5] imake sure mutable is available. --- packages/CLPBN/clpbn.yap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/CLPBN/clpbn.yap b/packages/CLPBN/clpbn.yap index 0d8733be9..ef70663b6 100644 --- a/packages/CLPBN/clpbn.yap +++ b/packages/CLPBN/clpbn.yap @@ -166,7 +166,8 @@ clpbn_flag(parameter_softening,Before,After) :- % we use a mutable variable to avoid unnecessary trailing. % store_var(El) :- - nb_current(clpbn_qvars, Mutable), !, + nb_current(clpbn_qvars, Mutable), + nonvar(Mutable), !, get_mutable(Tail, Mutable), update_mutable(El.Tail, Mutable). store_var(El) :- From 5baf42320ba687623519da1d671ac96ad6f5d464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Tue, 20 Sep 2011 09:55:09 +0100 Subject: [PATCH 5/5] recompute tables when commit. --- packages/CLPBN/learning/aleph_params.yap | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/CLPBN/learning/aleph_params.yap b/packages/CLPBN/learning/aleph_params.yap index 91f7b39cd..ea49bc0c3 100644 --- a/packages/CLPBN/learning/aleph_params.yap +++ b/packages/CLPBN/learning/aleph_params.yap @@ -128,9 +128,12 @@ store_cl(Cl) :- add_new_clause(_,(_ :- true),_,_) :- !. add_new_clause(_,(H :- B),_,_) :- +%trace, % user:db_usage, % user:db_dynamic, domain(H, K, V, D), + user:cost((H :- B), _, Cost), + format(user_error,'Current Cost: ~w.~n', [Cost]), rewrite_body(B, IB, Vs, _, ( !, { V = K with p(D, CPTList, Vs) })), % need to remember which CPT we want get_dist_key(Id, K),