add_factor should succeed if Constraints are satisfied
This commit is contained in:
parent
740dd0ce99
commit
114a6732f0
@ -142,6 +142,7 @@ add_factor(factor(Type, Id, Ks, _, _Phi, Constraints), NKs) :-
|
||||
%writeln(+Ks),
|
||||
( Ks = [K,Els], var(Els)
|
||||
->
|
||||
% aggregate factor
|
||||
once(run(Constraints)),
|
||||
avg_factors(K, Els, 0.0, NewKeys, NewId),
|
||||
NKs = [K|NewKeys]
|
||||
@ -150,8 +151,13 @@ add_factor(factor(Type, Id, Ks, _, _Phi, Constraints), NKs) :-
|
||||
NKs = Ks,
|
||||
Id = NewId
|
||||
),
|
||||
\+ f(Type, NewId, NKs),
|
||||
assert(f(Type, NewId, NKs)).
|
||||
(
|
||||
f(Type, NewId, NKs)
|
||||
->
|
||||
true
|
||||
;
|
||||
assert(f(Type, NewId, NKs))
|
||||
).
|
||||
|
||||
run([Goal|Goals]) :-
|
||||
call(user:Goal),
|
||||
|
Reference in New Issue
Block a user