fix stop_low_level_trace.
P Moura request for (?).
This commit is contained in:
parent
0efe86f3ba
commit
9b0b6ec649
@ -593,7 +593,6 @@ reset_control :-
|
|||||||
|
|
||||||
grow_atom_table(N):-
|
grow_atom_table(N):-
|
||||||
generate_atoms(N, 0),
|
generate_atoms(N, 0),
|
||||||
stop_low_level_trace,
|
|
||||||
garbage_collect_atoms.
|
garbage_collect_atoms.
|
||||||
generate_atoms(N, N):-!.
|
generate_atoms(N, N):-!.
|
||||||
generate_atoms(N, A):-
|
generate_atoms(N, A):-
|
||||||
@ -628,14 +627,14 @@ term_expansion_intern((Head<--Body), Module, C):-
|
|||||||
|
|
||||||
% converts ?:: prefix to ? :: infix, as handled by other clause
|
% converts ?:: prefix to ? :: infix, as handled by other clause
|
||||||
term_expansion_intern((Annotation::Fact), Module, ExpandedClause) :-
|
term_expansion_intern((Annotation::Fact), Module, ExpandedClause) :-
|
||||||
Annotation == '?',
|
Annotation == ( '?' ),
|
||||||
term_expansion_intern((? :: Fact :- true), Module, ExpandedClause).
|
term_expansion_intern(((?) :: Fact :- true), Module, ExpandedClause).
|
||||||
|
|
||||||
|
|
||||||
% handles decision clauses
|
% handles decision clauses
|
||||||
term_expansion_intern((Annotation :: Head :- Body), Module, problog:ExpandedClause) :-
|
term_expansion_intern((Annotation :: Head :- Body), Module, problog:ExpandedClause) :-
|
||||||
(
|
(
|
||||||
Annotation == '?' ->
|
Annotation == ('?') ->
|
||||||
% It's a decision with a body
|
% It's a decision with a body
|
||||||
(decision_fact(_,Head) ->
|
(decision_fact(_,Head) ->
|
||||||
throw(error('New decision unifies with already defined decision!', (Head))) ; true
|
throw(error('New decision unifies with already defined decision!', (Head))) ; true
|
||||||
@ -653,7 +652,7 @@ term_expansion_intern((Annotation :: Head :- Body), Module, problog:ExpandedClau
|
|||||||
(problog_control(check,internal_strategy) ->
|
(problog_control(check,internal_strategy) ->
|
||||||
dtproblog:strategy_log(ID,Head,LProb)
|
dtproblog:strategy_log(ID,Head,LProb)
|
||||||
;
|
;
|
||||||
LProb = '?'
|
LProb = ('?')
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
assertz(dynamic_probability_fact(ID)),
|
assertz(dynamic_probability_fact(ID)),
|
||||||
@ -1032,7 +1031,7 @@ prove_problog_fact(ClauseID,GroundID,Prob) :-
|
|||||||
(problog_control(check,find_decisions) ->
|
(problog_control(check,find_decisions) ->
|
||||||
signal_decision(ClauseID,GroundID)
|
signal_decision(ClauseID,GroundID)
|
||||||
;
|
;
|
||||||
(Prob = '?' ->
|
(Prob = ('?') ->
|
||||||
add_to_proof(GroundID,0) % 0 is log(1)!
|
add_to_proof(GroundID,0) % 0 is log(1)!
|
||||||
;
|
;
|
||||||
% Checks needed for LeDTProbLog
|
% Checks needed for LeDTProbLog
|
||||||
@ -1056,7 +1055,7 @@ prove_problog_fact_negated(ClauseID,GroundID,Prob) :-
|
|||||||
(problog_control(check,find_decisions) ->
|
(problog_control(check,find_decisions) ->
|
||||||
signal_decision(ClauseID,GroundID)
|
signal_decision(ClauseID,GroundID)
|
||||||
;
|
;
|
||||||
(Prob = '?' ->
|
(Prob = ('?') ->
|
||||||
add_to_proof_negated(GroundID,-inf) % 0 is log(1)!
|
add_to_proof_negated(GroundID,-inf) % 0 is log(1)!
|
||||||
;
|
;
|
||||||
% Checks needed for LeDTProbLog
|
% Checks needed for LeDTProbLog
|
||||||
@ -1190,7 +1189,7 @@ get_fact_probability(ID,Prob) :-
|
|||||||
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
|
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
|
||||||
),
|
),
|
||||||
arg(ProblogArity,ProblogTerm,Log),
|
arg(ProblogArity,ProblogTerm,Log),
|
||||||
(Log = '?' ->
|
(Log = ('?') ->
|
||||||
throw(error('Why do you want to know the probability of a decision?')) %fail
|
throw(error('Why do you want to know the probability of a decision?')) %fail
|
||||||
; ground(Log) ->
|
; ground(Log) ->
|
||||||
Prob is exp(Log)
|
Prob is exp(Log)
|
||||||
@ -1209,7 +1208,7 @@ get_fact_log_probability(ID,Prob) :-
|
|||||||
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
|
get_internal_fact(ID,ProblogTerm,_ProblogName,ProblogArity)
|
||||||
),
|
),
|
||||||
arg(ProblogArity,ProblogTerm,Prob),
|
arg(ProblogArity,ProblogTerm,Prob),
|
||||||
Prob \== '?'.
|
Prob \== ('?').
|
||||||
get_fact_log_probability(ID,Prob) :-
|
get_fact_log_probability(ID,Prob) :-
|
||||||
get_fact_probability(ID,Prob1),
|
get_fact_probability(ID,Prob1),
|
||||||
Prob is log(Prob1).
|
Prob is log(Prob1).
|
||||||
|
Reference in New Issue
Block a user