Skip to content

Commit

Permalink
solved issue #43
Browse files Browse the repository at this point in the history
Flexible probabilities with ProbLog syntax
  • Loading branch information
friguzzi committed Feb 1, 2022
1 parent 6f228b4 commit 6652d09
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions prolog/pita.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1159,27 +1159,37 @@

tab_dir(_M,'':_,[],[]):-!.

tab_dir(M,H:P,[],[H:P]):-
M:tabled(H),!.

% tab dir for decision variables
% merge with the previous one?
% the predicates are equal except
% (?)::H and H:P
tab_dir(M,HT,[],[H]):-
(HT = ?::H ; HT = (?)::H),
tab_dir(M,D::H,[],[H]):-
(D == ? ; D == (?)),
M:tabled(H),!.
% tab dir for decision variables
% merge with the previous one?
% the predicates are equal except
% (?)::H and '$util'(A,B)
tab_dir(M,H,[],[H]):-
M:tabled(H),!,
H=..[F|_],
F = utility.
F = utility,
M:tabled(H),!.

tab_dir(M,H:P,[],[H:P]):-
M:tabled(H),!.

tab_dir(M,P::H,[],[H:P]):-
P \== ?,
M:tabled(H),!.



tab_dir(M,H:P,[(:- table HT)],[H1:P]):-
% tab dir for decision variables
% merge with the previous one?
% the predicates are equal
% except variable n 2 and 4.
tab_dir(M,P::H,[(:- table HT)],[H1]):-
(P== ?;P == (?)),!,
functor(H,F,A0),
functor(PT,F,A0),
PT=..[F|Args0],
Expand All @@ -1196,12 +1206,13 @@
zero_clause(M,F/A0,LZ),
assert(M:zero_clauses(LZ)).

% tab dir for decision variables
% tab dir for utility variables
% merge with the previous one?
% the predicates are equal
% except variable n 2 and 4.
tab_dir(M,HT1,[(:- table HT)],[H1]):-
(HT1 = ?::H ; HT1 = (?)::H),
tab_dir(M,H,[(:- table HT)],[H1]):-
H=..[F|_],
F = utility,!,
functor(H,F,A0),
functor(PT,F,A0),
PT=..[F|Args0],
Expand All @@ -1218,13 +1229,9 @@
zero_clause(M,F/A0,LZ),
assert(M:zero_clauses(LZ)).

% tab dir for utility variables
% merge with the previous one?
% the predicates are equal
% except variable n 2 and 4.
tab_dir(M,H,[(:- table HT)],[H1]):-
H=..[F|_],
F = utility,

tab_dir(M,Head,[(:- table HT)],[H1:P]):-
(Head=H:P;Head=P::H),!,
functor(H,F,A0),
functor(PT,F,A0),
PT=..[F|Args0],
Expand All @@ -1241,6 +1248,7 @@
zero_clause(M,F/A0,LZ),
assert(M:zero_clauses(LZ)).


pita_expansion(begin_of_file,_):-
!,
fail.
Expand Down

0 comments on commit 6652d09

Please sign in to comment.