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,8 +55,8 @@ backtracking all the solutions with their corresponding probability
|
|||||||
Time1 is the time for performing resolution
|
Time1 is the time for performing resolution
|
||||||
Time2 is the time for performing bayesian inference */
|
Time2 is the time for performing bayesian inference */
|
||||||
sc(GL,GLC,P):-
|
sc(GL,GLC,P):-
|
||||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
(setof(Deriv,find_deriv(GLC,Deriv),LDupC)->
|
||||||
setof(Deriv,find_deriv(GLC,Deriv),LDupC),
|
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||||
append_all(LDup,[],L),
|
append_all(LDup,[],L),
|
||||||
remove_head(L,L1),
|
remove_head(L,L1),
|
||||||
append_all(LDupC,[],LC),
|
append_all(LDupC,[],LC),
|
||||||
@ -64,7 +64,13 @@ sc(GL,GLC,P):-
|
|||||||
append(L1,LC1,LD),
|
append(L1,LC1,LD),
|
||||||
remove_duplicates(LD,LD1),
|
remove_duplicates(LD,LD1),
|
||||||
build_ground_lpad(LD1,0,CL),
|
build_ground_lpad(LD1,0,CL),
|
||||||
convert_to_clpbn(CL,GL,LV,P,GLC).
|
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):-
|
s(GL,P,Time1,Time2):-
|
||||||
statistics(cputime,[_,_]),
|
statistics(cputime,[_,_]),
|
||||||
statistics(walltime,[_,_]),
|
statistics(walltime,[_,_]),
|
||||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||||
append_all(LDup,[],L),
|
append_all(LDup,[],L),
|
||||||
remove_head(L,L1),
|
remove_head(L,L1),
|
||||||
remove_duplicates(L1,L2),
|
remove_duplicates(L1,L2),
|
||||||
statistics(cputime,[_,CT1]),
|
|
||||||
CPUTime1 is CT1/1000,
|
|
||||||
statistics(walltime,[_,WT1]),
|
|
||||||
WallTime1 is WT1/1000,
|
|
||||||
build_ground_lpad(L2,0,CL),
|
build_ground_lpad(L2,0,CL),
|
||||||
convert_to_clpbn(CL,GL,LV,P),
|
convert_to_clpbn(CL,GL,LV,P),
|
||||||
statistics(cputime,[_,CT2]),
|
statistics(cputime,[_,CT2]),
|
||||||
CPUTime2 is CT2/1000,
|
Time1 is CT2/1000,
|
||||||
statistics(walltime,[_,WT2]),
|
statistics(walltime,[_,WT2]),
|
||||||
WallTime2 is WT2/1000.
|
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
|
/* sc(GoalsList,EvidenceList,Prob) compute the probability of a list of goals
|
||||||
GoalsList given EvidenceList. Both lists can have variables, sc returns in
|
GoalsList given EvidenceList. Both lists can have variables, sc returns in
|
||||||
@ -98,8 +107,8 @@ backtracking all the solutions with their corresponding probability */
|
|||||||
sc(GL,GLC,P,CPUTime1,CPUTime2,WallTime1,WallTime2):-
|
sc(GL,GLC,P,CPUTime1,CPUTime2,WallTime1,WallTime2):-
|
||||||
statistics(cputime,[_,_]),
|
statistics(cputime,[_,_]),
|
||||||
statistics(walltime,[_,_]),
|
statistics(walltime,[_,_]),
|
||||||
setof(Deriv,find_deriv(GL,Deriv),LDup),
|
(setof(Deriv,find_deriv(GLC,Deriv),LDupC)->
|
||||||
setof(Deriv,find_deriv(GLC,Deriv),LDupC),
|
(setof(Deriv,find_deriv(GL,Deriv),LDup)->
|
||||||
append_all(LDup,[],L),
|
append_all(LDup,[],L),
|
||||||
remove_head(L,L1),
|
remove_head(L,L1),
|
||||||
append_all(LDupC,[],LC),
|
append_all(LDupC,[],LC),
|
||||||
@ -115,8 +124,25 @@ sc(GL,GLC,P,CPUTime1,CPUTime2,WallTime1,WallTime2):-
|
|||||||
statistics(cputime,[_,CT2]),
|
statistics(cputime,[_,CT2]),
|
||||||
CPUTime2 is CT2/1000,
|
CPUTime2 is CT2/1000,
|
||||||
statistics(walltime,[_,WT2]),
|
statistics(walltime,[_,WT2]),
|
||||||
WallTime2 is WT2/1000.
|
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([],[]).
|
remove_head([],[]).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user