1

Case of use

First of all, I want to explain my case of use: I want to divide a field in different sectors and all plants should be analyzed by robots (just one robot per sector). I want to check in :preconditions that all plants for one sector are already analyzed, so that the robot return to the 'home'.

Problem

Here is the domain PDDL. My problem is placed in the preconditions of "tracker-back-home" action. Now I am checking if all the plants have been already analyzed, but I need to know if all the plants of the specific sector ?s are analyzed. It is possible to do using forall statement?

(define (domain killbee)
(:requirements :strips :typing)
(:types 
  bee location - object
  ;Inheritance
  tracker - bee
  hive plant sector - location
)
(:predicates 
  (directly-connected ?l1 - location ?l2 - location)
  (at ?l1 - object ?l2 - object) ;location is hive, plant or sector
  (free-sector ?s - sector)
  (bee-with-sector ?b - tracker)
  (tracker-ready-to-move ?b - tracker)
  (analyzed-plant ?p - plant ?s - sector)
  (sector-tracked ?s - sector)
  (plant-in-sector ?p - plant ?s - sector)
)
...
...
(:action tracker-back-home
:parameters (?b - tracker ?p - plant ?h - hive ?s - sector)
:precondition 
  (and (tracker-ready-to-move ?b)
  (at ?b ?p)
  (not (at ?b ?h))
  (forall (?x - plant) (analyzed-plant ?x ?s)))
  )
:effect 
  (and 
  (not (at ?b ?p))
  (at ?b ?h)
  (sector-tracked ?s)
  (not (bee-with-sector ?b))
  (free-sector ?s))
)...
Community
  • 1
  • 1
Alvaro Luis
  • 13
  • 1
  • 4

1 Answers1

1

Did you check out the language feature "imply" as defined by PDDL 2.1? (Maybe it was already defined before 2.1 -- not sure.) With it, you can define:

(forall (?pPrime - plant)
  (imply (at ?s ?pPrime) (analyzed-plant ?pPrime ?s))
)

Note: I am not sure whether the order of parameters in (at ?s ?pPrime) is correct. It's supposed to encode that the plant ?pPrime is in sector ?s.

The condition expands to a large set of implications reading that for all plants p' (no matter where they are) holds: "if plant p' is in s, then it's analyzed in s". This should encode exactly what you are looking for.

Prof.Chaos
  • 895
  • 8
  • 22
  • It totally worked. Just to mention the condition in 'imply' statement is (plant-in-sector ?pPrime ?s). Thank you! – Alvaro Luis Apr 28 '19 at 10:31
  • Do you mean that it should read "(plant-in-sector ?pPrime ?s)" instead of "(at ?s ?pPrime)" in the imly statement? I was restricting to those predicates that are defined in your example. "plant-in-sector" does not exist there. – Prof.Chaos Apr 29 '19 at 11:05
  • You are right that predicate is missing, I have updated the post with it. The solution is: (forall (?pPrime - plant) (imply (plant-in-sector ?pPrime ?s) (analyzed-plant ?pPrime ?s)) ) – Alvaro Luis May 04 '19 at 14:13