IIIM-IS / AERA

Other
12 stars 4 forks source link

In predict(), avoid injecting already predicted #248

Closed jefft0 closed 1 year ago

jefft0 commented 1 year ago

Background: Pull requests #186 and #243 allow matching multiple requirements during forward chaining. Usually the requirements have different parameters, so they make different predictions. But there can be duplicate predictions (especially if two models were learned that make the same predictions.) Duplicate predicted facts can result in duplicate predicted composite states, and these can produce further duplicates (especially during simulated forward chaining). We want to avoid a snowball effect.

This pull request updates the predict method to add a parameter already_predicted. The caller creates an empty list and passes it each time it calls predict. If the new prediction is not in the list, then it is injected and added to the list. If the new prediction is already in the list, then it is not injected.