Probabilistic Clause Choice
Its been a long time since I used Prolog in earnest, but I can't find any
reference to this by googling, or in the texts I have. This may be a
failure of terminology, so apologies if I massacre that.
If I have a program that could have multiple solutions:
likes(mary, joe).
likes(bob, joe).
:- likes(X, joe)
Is there a simple built-in way to have the solver run matching predicates
in random order, and therefore give results in a random order (or,
equivalently, have the first solution be random)?
Obviously you can get as sophisticated as you like with the word random.
I'm thinking of some uniform random sampling from the set of valid
predicates at each step of the solver. Something more complex like a
uniform random sampling over valid solutions is also fine. The issue is
general.
I can probably build a program to do this, using a random number
generator, and meta-programming. But I want to check if I'm missing
something simple.
No comments:
Post a Comment