It would be great to be able to have plan tree's returned incrementally along with plans via plan-found-hook
I'm afraid I don't have the time to do this myself, but it would be a relatively simple extension for an interested party to make. Here's the short answer:
Find the call to plan-found-hook. You need to add a plan tree to the arguments passed to it.
Plan trees are not normally computed, so you need to do this. Fortunately, it should be pretty simple. The additional argument you would want to pass would be:
(apply-substitution (extract-tree plan) unifier)
So you could modify the call to:
(when (fboundp 'plan-found-hook)
(funcall (fdefinition 'plan-found-hook)
state which-plans final-plan partial-plan-cost depth
(apply-substitution (extract-tree final-plan) unifier)))
[As an aside, I'm pretty sure that FDEFINITION there is unnecessary -- could be just (FUNCALL 'PLAN-FOUND-HOOK ...)]
Then write whatever function you want to be the definition of SHOP2:PLAN-FOUND-HOOK
(defun shop2:plan-found-hook (state which-plans final-plan cost depth tree)
Thanks for the prompt response Robert - I had already tried that but it wasn't working (all I was getting back was the operators without the methods) - but it seems if I run (find-plans) with :plan-tree t as arguments then it does work. Cheers.
That makes sense: we may not be collecting enough information to create the plan trees if you don't pass :plan-tree t into find-plans. Haven't actually checked.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.