1

For example, if I declare types as such:

:types
   bag
   light heavy - bag

That is to say there are two types of bags, light and heavy. Would it be possible within an action to check if a variable of type bag is of type light without having an instance of light to compare to?

I know it's possible to have an equality comparison as such:

(when ( = ?light ?bag))

but this checks if two variables have the same value, rather than the same type.

I tried (when ( = light ?bag)) and even though the planner doesn't throw up errors it doesn't seem to work.

McGuile
  • 818
  • 1
  • 11
  • 29
  • 2
    The short answer is no. There is no built-in possibility in PDDL to compare types (or, more specifically, to test whether a variable is of a specific type). There are workarounds for this, but maybe you will be able to derive them for yourself. If not, just say so, maybe I'll find the time to explain. – Prof.Chaos Oct 30 '17 at 06:04
  • Thanks, I've came up with a workaround. – McGuile Oct 30 '17 at 11:35

1 Answers1

3

In response to Prof. Chaos' comment where they state this is not possible, I've derived a workaround where we create the predicate (is_light ?x - light) and use (when (is_light ?lightobj) (dosomething)) in the action. The predicate is utilised in the problem file when initialising light objects.

McGuile
  • 818
  • 1
  • 11
  • 29