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)) { 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 */ } } 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) :- 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),