[rules-users] Approach for poor man's backtracking?

Ingomar Otter iotter at mac.com
Tue Jul 8 11:43:25 EDT 2008


Hello,
I am looking for an approach to implement "poor man's backtracking" in  
Drools.

What I am trying to do is to collect "the impact" of alternate  
decisions. In some situations I can not "decide" which path to follow  
and what I need to do is to explore several paths and take a decision  
based on that results. What I have done so far is to collect the  
alternatives as I find them in a list and inserted them one by one.  
What I need to do then is to restore the state (backtrack) after I  
have explored one path.
My initial approach was to use logicals for this (insert the  
"hypothesis", see what happens/ collect the results and retract the  
hypothesis). However this messes with the rest of my ruleset quite a  
bit. Then I was thinking of maintaining special flags on the asserted  
facts but this seems like a kludge to me. So I was wondering whether  
someone is aware of a more elegant / generic approach to implement  
such backtracking with Drools.
Any hints appreciated.

Cheers,
   Ingomar



More information about the rules-users mailing list