[rules-users] Decision tree, Is this scenario possible in Drools 5.x, need to fire a new question based on the answer of previous

rjr201 rich.j.riley at gmail.com
Fri Jun 7 05:43:30 EDT 2013


I don't think it'd be too hard to model a decision tree in a .drl file. 

You'd need a rule for each node/transition in your graph. Something like: 

WHEN 
   $cn : CurrentNode( Node(name == "Is the dispute related to Unauthorised")
)
   $d : Decision ( answer = "Yes" )
   $nextNode : Node (name == "CM disputes the charge..")
THEN 
   retract $cn
   retract $d
   insert new CurrentNode($nextNode)
END

Then create rules that halt at nodes that have no transitions leading out of
them (end nodes).

You could then start it as a statefull session, and input the decisions one
by one until an end node is reached. 

I've done that kind of thing before and it's not been too cumbersome. But
then I don't know the context of what you are doing.. 



--
View this message in context: http://drools.46999.n3.nabble.com/Decision-tree-Is-this-scenario-possible-in-Drools-5-x-need-to-fire-a-new-question-based-on-the-answes-tp4024193p4024198.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list