pddl4j icon indicating copy to clipboard operation
pddl4j copied to clipboard

No plan found with HDDL although it exists

Open AlexDmr opened this issue 6 months ago • 0 comments

The fr.uga.pddl4j.planners.htn.stn.TFD does not always find plan when there is an obvious one Here are data for a minimal test reproduction (sorry, there is only a linter for PDDL, not HDDL). I used the jar from the website, I also cloned PDDL4J and compiled the code on the devel branch.

Plan is searched with :

java -cp ./pddl4j-4.0.0.jar fr.uga.pddl4j.planners.htn.stn.TFD ./domain.hddl ./problem.pddl

and

java -cp ./pddl4j-4.0.0.jar fr.uga.pddl4j.planners.htn.stn.PFD ./domain.hddl ./problem.pddl

A problem where the planner find a plan :

 (define (problem todolist)
    (:domain todolist)
    (:objects
        a b c d - object
        L - list
    )

    (:htn
        :parameters ()
        :ordered-subtasks (doManageListOneOp L)
    )
    (:init
        ;todo: put the initial state's facts and numeric values here
        (listSeq L listStart listEnd)
        (listElement L listStart)
        (listElement L listEnd)
    )

)

A problem where the planner fail to find a plan, although it should : TFD says that the problem is not totally ordered. PFD find no plan.

 (define (problem todolist)
    (:domain todolist)
    (:objects
        a b c d - object
        L - list
    )
    (:htn
        :parameters ()
        :ordered-subtasks (doManageList L)
    )
    (:init
        ;todo: put the initial state's facts and numeric values here
        (listSeq L listStart listEnd)
        (listElement L listStart)
        (listElement L listEnd)
    )
)

The HDDL domain :

(define (domain todolist)
    (:requirements :strips :equality :typing :conditional-effects :negative-preconditions :universal-preconditions :existential-preconditions :hierarchy)

    (:types
        list - object
    )

    (:constants
        listStart listEnd - object
    )

    (:predicates
        (listElement ?L - list ?e - object)
        (listSeq ?listId - list ?a - object ?b - object)
    )


    (:task doManageList
        :parameters (?L - list)
    )

    (:task doManageListOneOp
        :parameters (?L - list)
    )

    (:method doManageListMtdRec
        :parameters (?L - list)
        :task (doManageList ?L)
        :ordered-subtasks (and
            (task0 (doManageListOneOp ?L))
            (task1 (doManageListOneOp ?L))
        )
    )


    (:method mtdManageListAppend
        :parameters (?L - list ?e - object ?last - object)
        :task (doManageListOneOp ?L)
        :ordered-subtasks (and
            (task0 (append ?L ?e ?last))
        )
    )

    (:action append
        :parameters (?L - list ?e - object ?last - object)
        :precondition (and
            (not (listElement ?L ?e))
            (listSeq ?L ?last listEnd)
        )
        :effect (and
            (listElement ?L ?e)
            ; insert at the end
            (not (listSeq ?L ?last listEnd))
            (listSeq ?L ?last ?e)
            (listSeq ?L ?e listEnd)
        )
    )
)

AlexDmr avatar Dec 08 '23 15:12 AlexDmr