aiplan4eu / unified-planning

The AIPlan4EU Unified Planning Library
Apache License 2.0
181 stars 39 forks source link

Constants support #568

Open fmrico opened 7 months ago

fmrico commented 7 months ago

Hi,

I have found that UP fails to read a problem from a pddl file in the line that contains a constant:

(:constants Table)

I also don't find a way to define constants directly using the UP API in Python.

Are constants supported in UP? How can I do it?

My use case is the traditional blocks world [domain, problem]

Thanks!!

mikand commented 7 months ago

@Framba-Luca can you check if this is supported in our parser?

The UP does not distinguish between domain and problem, so a constant is just another object for us. But indeed I am not sure if this is currently supported by our parser.

Framba-Luca commented 7 months ago

Hi @fmrico , so I tested and the problem is not that it's a constant, but that in the grammar that we chose to support constants must be defined before predicates. So, I changed the domain like this:

(:constants Table - object)

(:predicates
  (on ?x ?y)
  (clear ?x)
  (block ?b)
)

and it correctly works.

Let me know if this solves your issue

mikand commented 7 months ago

Ah OK, so it is a manifestation of #475