McGuile
McGuile

Reputation: 828

Is it possible to have type comparison in PDDL?

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.

Upvotes: 1

Views: 2060

Answers (1)

McGuile
McGuile

Reputation: 828

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.

Upvotes: 3

Related Questions