Merge branch 'master' of yap.dcc.fc.up.pt:yap-6

This commit is contained in:
Vitor Santos Costa 2010-09-21 22:01:08 +01:00
commit 9d0f414d30
6 changed files with 12238 additions and 2606 deletions

View File

@ -577,7 +577,7 @@ install_unix: startup.yss libYap.a
$(INSTALL) config.h $(DESTDIR)$(INCLUDEDIR)/config.h $(INSTALL) config.h $(DESTDIR)$(INCLUDEDIR)/config.h
$(INSTALL) parms.h $(DESTDIR)$(INCLUDEDIR)/parms.h $(INSTALL) parms.h $(DESTDIR)$(INCLUDEDIR)/parms.h
@ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) install) @ENABLE_CPLINT@ (cd packages/cplint; $(MAKE) install)
@ENABLE_CPLINT@ (cd packages/cplint/simplecuddLPADs; $(MAKE) install) @ENABLE_CPLINT@ (cd packages/cplint/approx/simplecuddLPADs; $(MAKE) install)
@USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install) @USE_CUDD@ (cd packages/ProbLog/simplecudd; $(MAKE) install)

14778
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -126,7 +126,7 @@ AC_ARG_ENABLE(dlcompat,
use_dlcompat="$enableval", use_dlcompat=no) use_dlcompat="$enableval", use_dlcompat=no)
AC_ARG_ENABLE(cplint, AC_ARG_ENABLE(cplint,
[ --enable-cplint[=DIR] enable the cplint library using the glu library in DIR/lib], [ --enable-cplint[=DIR] enable the cplint library using the CUDD software in DIR],
yap_cv_cplint=$enableval, yap_cv_cplint=no) yap_cv_cplint=$enableval, yap_cv_cplint=no)
AC_ARG_WITH(gmp, AC_ARG_WITH(gmp,

View File

@ -338,9 +338,9 @@ TrNode breadth_reduction(TrEntry trie, TrNode breadth_node, YAP_Int opt_level) {
stop_data = TrData_previous(TrEntry_first_data(trie)); stop_data = TrData_previous(TrEntry_first_data(trie));
data = TrEntry_traverse_data(trie) = TrEntry_last_data(trie); data = TrEntry_traverse_data(trie) = TrEntry_last_data(trie);
while ((data != stop_data) && (data != NULL)) { while ((data != stop_data) && (data != NULL)) {
/* printf("hi1\n");*/ // printf("hi\n");
node = core_breadth_reduction(TRIE_ENGINE, TrData_leaf(data), breadth_node, opt_level, &trie_data_construct, &trie_data_destruct, &trie_data_copy, &trie_data_order_correction); node = core_breadth_reduction(TRIE_ENGINE, TrData_leaf(data), breadth_node, opt_level, &trie_data_construct, &trie_data_destruct, &trie_data_copy, &trie_data_order_correction);
// printf("bye1\n"); // printf("bye\n");
if (node && IS_FUNCTOR_NODE(TrNode_parent(node)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(node))))), NESTED_TRIE_TERM) == 0)) { if (node && IS_FUNCTOR_NODE(TrNode_parent(node)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(node))))), NESTED_TRIE_TERM) == 0)) {
//nested trie stop procedure return nested trie node //nested trie stop procedure return nested trie node
return node; return node;

View File

@ -553,7 +553,7 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
child = TrNode_child(child); child = TrNode_child(child);
} else } else
child = TrNode_child(node); child = TrNode_child(node);
/* printf("start node: "); displaynode(child);*/ // printf("Chosen start node: "); displaynode(child);
if (IS_HASH_NODE(child)) { if (IS_HASH_NODE(child)) {
printf("warning\n"); printf("warning\n");
TrNode *first_bucket, *bucket; TrNode *first_bucket, *bucket;
@ -576,6 +576,8 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
} }
} }
TrNode temp = TrNode_child(child); TrNode temp = TrNode_child(child);
if (temp == NULL)
return NULL;
if (IS_HASH_NODE(temp)) { if (IS_HASH_NODE(temp)) {
TrNode *first_bucket2, *bucket2; TrNode *first_bucket2, *bucket2;
TrHash hash2 = (TrHash) temp; TrHash hash2 = (TrHash) temp;
@ -591,8 +593,6 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
while((temp != NULL) && (TrNode_entry(temp) != PairEndTag)) while((temp != NULL) && (TrNode_entry(temp) != PairEndTag))
temp = TrNode_next(temp); temp = TrNode_next(temp);
} }
if (temp == NULL)
return NULL;
//Nested Trie code //Nested Trie code
if (IS_FUNCTOR_NODE(TrNode_parent(child)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(child))))), NESTED_TRIE_TERM) == 0)) { if (IS_FUNCTOR_NODE(TrNode_parent(child)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(child))))), NESTED_TRIE_TERM) == 0)) {
/* nested trie: stop procedure and return nested trie node */ /* nested trie: stop procedure and return nested trie node */
@ -628,6 +628,9 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
} }
} }
TrNode temp = TrNode_child(child); TrNode temp = TrNode_child(child);
if (temp == NULL)
return NULL;
// printf("Chosen start node child: "); displaynode(temp);
if (IS_HASH_NODE(temp)) { if (IS_HASH_NODE(temp)) {
TrNode *first_bucket, *bucket; TrNode *first_bucket, *bucket;
TrHash hash = (TrHash) temp; TrHash hash = (TrHash) temp;
@ -644,8 +647,7 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
while((temp != NULL) && (TrNode_entry(temp) != PairEndTag)) while((temp != NULL) && (TrNode_entry(temp) != PairEndTag))
temp = TrNode_next(temp); temp = TrNode_next(temp);
} }
if (temp == NULL) // printf("while end\n");
return NULL;
//Nested Trie code //Nested Trie code
if (IS_FUNCTOR_NODE(TrNode_parent(child)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(child))))), NESTED_TRIE_TERM) == 0)) { if (IS_FUNCTOR_NODE(TrNode_parent(child)) && (strcmp(YAP_AtomName(YAP_NameOfFunctor((YAP_Functor)(~ApplTag & TrNode_entry(TrNode_parent(child))))), NESTED_TRIE_TERM) == 0)) {
/* nested trie: stop procedure and return nested trie node */ /* nested trie: stop procedure and return nested trie node */
@ -664,7 +666,7 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
} }
child = TrNode_next(child); child = TrNode_next(child);
} while (child); } while (child);
// printf("pass through\n"); // printf("pass through\n");
} }
if (!count) { if (!count) {
/* termination condition */ /* termination condition */
@ -684,7 +686,7 @@ TrNode core_breadth_reduction(TrEngine engine, TrNode node, TrNode breadth_node,
node = trie_node_check_insert(node, t); node = trie_node_check_insert(node, t);
node = trie_node_check_insert(node, PairEndTag); node = trie_node_check_insert(node, PairEndTag);
INCREMENT_ENTRIES(CURRENT_TRIE_ENGINE); INCREMENT_ENTRIES(CURRENT_TRIE_ENGINE);
// printf("end node: "); displaynode(node); // printf("end node: "); displaynode(node);
return node; return node;
} }

View File

@ -2,8 +2,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% $Date: 2010-08-30 18:09:17 +0200 (Mon, 30 Aug 2010) $ % $Date: 2010-09-07 23:20:03 +0200 (Tue, 07 Sep 2010) $
% $Revision: 4728 $ % $Revision: 4765 $
% %
% This file is part of ProbLog % This file is part of ProbLog
% http://dtai.cs.kuleuven.be/problog % http://dtai.cs.kuleuven.be/problog
@ -268,12 +268,12 @@
% Define module flags % Define module flags
%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
:- problog_define_flag(use_db_trie, problog_flag_validate_boolean, 'use the builtin trie 2 trie transformation', true). :- problog_define_flag(use_db_trie, problog_flag_validate_boolean, 'use the builtin trie 2 trie transformation', false).
:- problog_define_flag(db_trie_opt_lvl, problog_flag_validate_integer, 'optimization level for the trie 2 trie transformation', 0). :- problog_define_flag(db_trie_opt_lvl, problog_flag_validate_integer, 'optimization level for the trie 2 trie transformation', 0).
:- problog_define_flag(compare_opt_lvl, problog_flag_validate_boolean, 'comparison mode for optimization level', false). :- problog_define_flag(compare_opt_lvl, problog_flag_validate_boolean, 'comparison mode for optimization level', false).
:- problog_define_flag(db_min_prefix, problog_flag_validate_integer, 'minimum size of prefix for dbtrie to optimize', 2). :- problog_define_flag(db_min_prefix, problog_flag_validate_integer, 'minimum size of prefix for dbtrie to optimize', 2).
:- problog_define_flag(use_naive_trie, problog_flag_validate_boolean, 'use the naive algorithm to generate bdd scripts', false). :- problog_define_flag(use_naive_trie, problog_flag_validate_boolean, 'use the naive algorithm to generate bdd scripts', false).
:- problog_define_flag(use_old_trie, problog_flag_validate_boolean, 'use the old trie 2 trie transformation no nested', false). :- problog_define_flag(use_old_trie, problog_flag_validate_boolean, 'use the old trie 2 trie transformation no nested', true).
:- problog_define_flag(use_dec_trie, problog_flag_validate_boolean, 'use the decomposition method', false). :- problog_define_flag(use_dec_trie, problog_flag_validate_boolean, 'use the decomposition method', false).
:- problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true). :- problog_define_flag(subset_check, problog_flag_validate_boolean, 'perform subset check in nested tries', true).
:- problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false). :- problog_define_flag(deref_terms, problog_flag_validate_boolean, 'deref BDD terms after last use', false).
@ -502,7 +502,7 @@ trie_to_bdd_struct_trie(A, B, OutputFile, OptimizationLevel, Variables) :-
write(VarCNT), nl, write(VarCNT), nl,
write(0), nl, write(0), nl,
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, LL),
write(LL), nl, write(LL), nl,
told told
; ;
@ -545,13 +545,13 @@ nested_trie_to_bdd_struct_trie(A, B, OutputFile, OptimizationLevel, Variables):-
InterStep is NegStepN + 1, InterStep is NegStepN + 1,
atomic_concat('L', InterStep, FL), atomic_concat('L', InterStep, FL),
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, FL),
write(FL), write(' = ~'), write(NegL), nl, write(FL), write(' = ~'), write(NegL), nl,
write(FL), nl write(FL), nl
; ;
atomic_concat('L', InterStep, LL), atomic_concat('L', InterStep, LL),
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, LL),
write(LL), nl write(LL), nl
), ),
told told
@ -1273,7 +1273,7 @@ trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):-
write(VarCNT), nl, write(VarCNT), nl,
write(0), nl, write(0), nl,
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, LL),
write(LL), nl, write(LL), nl,
told told
; ;
@ -1331,13 +1331,13 @@ nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):-
InterStep is NegStepN + 1, InterStep is NegStepN + 1,
atomic_concat('L', InterStep, FL), atomic_concat('L', InterStep, FL),
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, FL),
write(FL), write(' = ~'), write(NegL), nl, write(FL), write(' = ~'), write(NegL), nl,
write(FL), nl write(FL), nl
; ;
atomic_concat('L', InterStep, LL), atomic_concat('L', InterStep, LL),
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, LL),
write(LL), nl write(LL), nl
), ),
told told
@ -1375,7 +1375,7 @@ nested_trie_to_bdd_trie(A, B, OutputFile, OptimizationLevel, FileParam):-
write(VarCNT), nl, write(VarCNT), nl,
write(0), nl, write(0), nl,
write(InterStep), nl, write(InterStep), nl,
trie_write(B), trie_write(B, LL),
write(LL), nl, write(LL), nl,
told told
; ;
@ -1675,19 +1675,24 @@ replace_in_functor(F, NF, T, R):-
trie_write(T):- trie_write(T, MAXL):-
atomic_concat('L', MAXLA, MAXL),
atom_number(MAXLA, MAXLN),
trie_traverse(T, R), trie_traverse(T, R),
trie_get_entry(R, L), trie_get_entry(R, L),
%write(user_output, L),nl(user_output), %write(user_output, L),nl(user_output),
(dnfbddformat(L) -> (dnfbddformat(L, MAXLN) ->
true true
; ;
write(error(L)), nl write(user_error, warning(L, not_processed)), nl(user_error)
), ),
fail. fail.
trie_write(_). trie_write(_, _).
dnfbddformat(depth(T, L)):- dnfbddformat(depth(T, L), MAXL):-
atomic_concat('L', LA, L),
atom_number(LA, LN),
MAXL >= LN,
seperate(T, Li, V), seperate(T, Li, V),
%sort(Li, SL), %sort(Li, SL),
%reverse(SL, RSL), %reverse(SL, RSL),
@ -1697,7 +1702,10 @@ dnfbddformat(depth(T, L)):-
atomic_concat('L', D, I), atomic_concat('L', D, I),
write('D'), write(D), nl write('D'), write(D), nl
)). )).
dnfbddformat(breadth(T, L)):- dnfbddformat(breadth(T, L), MAXL):-
atomic_concat('L', LA, L),
atom_number(LA, LN),
MAXL >= LN,
seperate(T, Li, V), seperate(T, Li, V),
%sort(Li, SL), %sort(Li, SL),
%reverse(SL, RSL), %reverse(SL, RSL),