panda-planner-dev / pandaPIparser

The parser of the pandaPI planning system
BSD 3-Clause "New" or "Revised" License
13 stars 10 forks source link

Missing goal in HPDL output #31

Closed Maumagnaguagno closed 8 months ago

Maumagnaguagno commented 8 months ago

It appears that goals in the HDDL problem are ignored in the conversion to HPDL. If we consider the minimal HDDL planning instance below:

(define (domain test1)
  (:requirements :hierarchy)
  (:predicates (a) (b) (c))
  (:action act
    :parameters ()
    :precondition (a)
    :effect (b)
  )
)
(define(problem whereismygoal)
  (:domain test1)
  (:objects )
  (:htn :ordered-tasks (act))
  (:init (a))
  (:goal (c))
)

And convert to HPDL with ./pandaPIparser/pandaPIparser --hpdl test1_domain.hddl test1_problem.hddl test1_domain.hddl.hpdl test1_problem.hddl.hpdl, we obtain the following HPDL:

(define (domain dom)
  (:requirements 
    :typing
    :htn-expansion
    :negative-preconditions
    :conditional-effects
    :universal-preconditions
    :disjunctive-preconditions
    :equality
    :existential-preconditions
  )
  (:types 
  )

  (:constants
  )

  (:predicates
    (a)
    (b)
    (c)
  )

  (:task act
    :parameters ()
    (:method method1
      :precondition (
      )
      :tasks (
        (act_primitive)
      )
    )
  )

; ************************************************************
; ************************************************************
  (:action act_primitive
    :parameters ()
    :precondition (and
      (a)
    )
    :effect (and
      (b)
    )
  )

)
(define (problem prob) (:domain dom)
  (:objects
  )

  (:init
    (a)
  )

  (:tasks-goal
      :tasks (
        (act)
      )
  )
)

The goal (c) is impossible in the HDDL description, while the resulting HPDL relaxed the problem and made it solvable. Now, Siadex does not support PDDL goals, one must be creative to support it. I suggest to create a new primitive operator without parameters and add the goal description as precondition, making this the last ordered top-level task.

On a separate note, I would like to know why a method was created, it does not appear to be required by Siadex.

Maumagnaguagno commented 8 months ago

Oh, I discovered in the --help output the flag --goal-action that enables the behavior I was looking for, but never mentioned in the README. I believe this should be enabled by default.