1

I was looking for a way to set a comparison as a precondition to an action in PDDL. Is there a way to say for example:

(:functions (goal))    

(:action CheckLoser  
    :parameters  (?team)  
    :precondition  
        (> goals 5)  
    :effect  
        (loses ?team)  
)
Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
Jamidd
  • 41
  • 1
  • 6
  • Sorry, i forgot to mention that i am currently using fast downward, and apparently it doesn't allow this type of predicates. Is there a planner that does?? – Jamidd Sep 20 '17 at 23:39
  • I don't know if PPDDL has anything to do with all this, maybe. But i haven't been able to find a PPDDL planner. – Jamidd Sep 20 '17 at 23:42

2 Answers2

1

Fast Downward doesn't support using an arithmetic comparison as an action precondition, but the planner Metric-FF does. The latter can be downloaded from here, and it is easy to install:

  • ensure flex and bison are installed on your system; On Ubuntu just use:

    sudo apt-get install bison flex
    
  • run make in the source directory

Metric-FF can be executed as follows :

./ff -o path/to/domain.pddl -f path/to/problem.pddl

To solve the problem in the question, I used a variable cost to track the time and allowed an action to occur after a certain amount of time has passed.

My code sample is as follows:

  • Define a :predicate in the domain file, e.g. (cost ?cost)
  • Define a :function in the domain file, e.g. (:functions (total-cost ?cost))
  • Add (cost) in the :objects part of the problem file
  • In the :init part of the problem file, set the "time" to start as "x", e.g. (= (total-cost ?cost) 0) where "time" is cost and "x" is equal to 0.
  • Now it is possible to use the arithmetic comparison in any action precondition; e.g. (> (total-cost ?cost) x), where x can be set to any value (including floating point numbers); Note that in this case ?cost must be included in the :parameters section of the said action
  • Finally, the value of total-cost can be increased (resp. decreased) after every action execution with (increase (total-cost ?cost) x) (resp. (decrease (total-cost ?cost) x)), where x can again be replace with any value.
Patrick Trentin
  • 7,126
  • 3
  • 23
  • 40
Jamidd
  • 41
  • 1
  • 6
0

In PDDL you cannot compare directly, Instead you can define some boolean function with parameters. Specification of such function in precondition means that the function holds true. eg:

(operation
 makebigger
  (params
   (<a> Object) (<b> Object))
  (preconds
    (greater <a> <b>))
   effects
    (greater <b> <a>)))

Something like greater function(written in preorder). Such boolean function that states a precondition will be used in your planning.

nikhil kekan
  • 532
  • 3
  • 16