fixed degererated cond queries
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2227 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
111d8c4eee
commit
5575cdbd4f
@ -55,16 +55,22 @@ backtracking all the solutions with their corresponding probability
|
||||
Time1 is the time for performing resolution
|
||||
Time2 is the time for performing bayesian inference */
|
||||
sc(GL,GLC,P):-
|
||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
||||
setof(Deriv,find_deriv(GLC,Deriv),LDupC),
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
append_all(LDupC,[],LC),
|
||||
remove_head(LC,LC1),
|
||||
append(L1,LC1,LD),
|
||||
remove_duplicates(LD,LD1),
|
||||
build_ground_lpad(LD1,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P,GLC).
|
||||
(setof(Deriv,find_deriv(GLC,Deriv),LDupC)->
|
||||
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
append_all(LDupC,[],LC),
|
||||
remove_head(LC,LC1),
|
||||
append(L1,LC1,LD),
|
||||
remove_duplicates(LD,LD1),
|
||||
build_ground_lpad(LD1,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P,GLC)
|
||||
;
|
||||
P=0.0
|
||||
)
|
||||
;
|
||||
P=undef
|
||||
).
|
||||
|
||||
|
||||
|
||||
@ -76,20 +82,23 @@ Time2 is the time for performing bayesian inference */
|
||||
s(GL,P,Time1,Time2):-
|
||||
statistics(cputime,[_,_]),
|
||||
statistics(walltime,[_,_]),
|
||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
remove_duplicates(L1,L2),
|
||||
statistics(cputime,[_,CT1]),
|
||||
CPUTime1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
WallTime1 is WT1/1000,
|
||||
build_ground_lpad(L2,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P),
|
||||
statistics(cputime,[_,CT2]),
|
||||
CPUTime2 is CT2/1000,
|
||||
statistics(walltime,[_,WT2]),
|
||||
WallTime2 is WT2/1000.
|
||||
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
remove_duplicates(L1,L2),
|
||||
build_ground_lpad(L2,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P),
|
||||
statistics(cputime,[_,CT2]),
|
||||
Time1 is CT2/1000,
|
||||
statistics(walltime,[_,WT2]),
|
||||
Time2 is WT2/1000
|
||||
;
|
||||
P=0.0,
|
||||
statistics(cputime,[_,CT1]),
|
||||
Time1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
Time2 is WT1/1000
|
||||
).
|
||||
|
||||
/* sc(GoalsList,EvidenceList,Prob) compute the probability of a list of goals
|
||||
GoalsList given EvidenceList. Both lists can have variables, sc returns in
|
||||
@ -98,25 +107,42 @@ backtracking all the solutions with their corresponding probability */
|
||||
sc(GL,GLC,P,CPUTime1,CPUTime2,WallTime1,WallTime2):-
|
||||
statistics(cputime,[_,_]),
|
||||
statistics(walltime,[_,_]),
|
||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
||||
setof(Deriv,find_deriv(GLC,Deriv),LDupC),
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
append_all(LDupC,[],LC),
|
||||
remove_head(LC,LC1),
|
||||
append(L1,LC1,LD),
|
||||
remove_duplicates(LD,LD1),
|
||||
statistics(cputime,[_,CT1]),
|
||||
CPUTime1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
WallTime1 is WT1/1000,
|
||||
build_ground_lpad(LD1,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P,GLC),
|
||||
statistics(cputime,[_,CT2]),
|
||||
CPUTime2 is CT2/1000,
|
||||
statistics(walltime,[_,WT2]),
|
||||
WallTime2 is WT2/1000.
|
||||
|
||||
(setof(Deriv,find_deriv(GLC,Deriv),LDupC)->
|
||||
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||
append_all(LDup,[],L),
|
||||
remove_head(L,L1),
|
||||
append_all(LDupC,[],LC),
|
||||
remove_head(LC,LC1),
|
||||
append(L1,LC1,LD),
|
||||
remove_duplicates(LD,LD1),
|
||||
statistics(cputime,[_,CT1]),
|
||||
CPUTime1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
WallTime1 is WT1/1000,
|
||||
build_ground_lpad(LD1,0,CL),
|
||||
convert_to_clpbn(CL,GL,LV,P,GLC),
|
||||
statistics(cputime,[_,CT2]),
|
||||
CPUTime2 is CT2/1000,
|
||||
statistics(walltime,[_,WT2]),
|
||||
WallTime2 is WT2/1000
|
||||
;
|
||||
P=0.0,
|
||||
statistics(cputime,[_,CT1]),
|
||||
CPUTime1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
WallTime1 is WT1/1000,
|
||||
CPUTime2 =0.0,
|
||||
WallTime2 =0.0
|
||||
)
|
||||
;
|
||||
P=undef,
|
||||
statistics(cputime,[_,CT1]),
|
||||
CPUTime1 is CT1/1000,
|
||||
statistics(walltime,[_,WT1]),
|
||||
WallTime1 is WT1/1000,
|
||||
CPUTime2 =0.0,
|
||||
WallTime2 =0.0
|
||||
).
|
||||
|
||||
remove_head([],[]).
|
||||
|
||||
|
Reference in New Issue
Block a user