1

I am both using durative actions and trying to be able to clear a predicate over all elements of a certain type. See below. Is this possible? If so, does anyone know the correct syntax? Thanks!

    (:durative-action init
      :parameters (?r - robot)
      :duration ( = ?duration 1)
      :condition (and
             (at start (robot_uninitialized ?r))
             (at start (robot_free ?r))
                 )
      :effect (and
          (at start(not(robot_free ?r)))
          (at end (assign (robot_on_fastener_number_in_sequence) 1))
          (at end (not(robot_uninitialized ?r)))
          (at end (robot_free ?r))
          (at end (forall (?f - fastener) (not(fastener_selected ?f))))
          )
    )

I am running the popf planner and the error provided is: Syntax error in timed effect.

Jan Dolejsi
  • 1,389
  • 13
  • 25
steveb
  • 43
  • 4

2 Answers2

2

The VAL parser indeed shows the Syntax error in timed effect error. I tried to invert the order of at end and forall and it stopped complaining. As popf is using the same parser, it should be happy with that syntax too.

  :effect (and
      (forall (?f - fastener) 
          (at end (not (fastener_selected ?f)))
      )
  )

But in the condition, VAL accepts the syntax in the opposite order:

    :condition (and
        (at end (forall (?f - fastener) 
            (fastener_selected ?f))
        )
    )

Full example: http://editor.planning.domains/#read_session=BCBDpV4YQE

Jan Dolejsi
  • 1,389
  • 13
  • 25
  • Thanks! This solved my issue. Tried to give it a plus, but don't have enough points. – steveb Jul 16 '20 at 17:44
  • One more question... is it possible to have a "forall" statement in the conditions clause? Copying the above to the condition causes a syntax error (even without the "not"). – steveb Jul 16 '20 at 17:55
  • Sure it is. You can find syntax examples here: https://planning.wiki/ref/pddl/domain – Jan Dolejsi Jul 16 '20 at 18:28
  • Here is a full example. http://editor.planning.domains/#read_session=BCBDpV4YQE Interestingly, VAL and Popf accepts the forall condition, but in the opposite order: ``` (at end (forall (?f - fastener) (fastener_selected ?f)) ) ``` – Jan Dolejsi Jul 16 '20 at 18:43
  • Thank you! That helped me a lot. Strange how the syntax changes between the condition and effect clauses. – steveb Jul 20 '20 at 12:24
0

The "complete" PDDL3.1 BNF version that is typically used specifically states that what you are trying is not allowed. However, it is most probably a mistake that got carried over from the original grammar definition, that propagated down to the parser implementations (or maybe vice-versa?)

A durative action effect <da-effect> is defined as follows:

<da-effect> ::= (and <da-effect>*)
<da-effect> ::= <timed-effect>
<da-effect> ::= (forall (<typed list (variable)>) <da-effect>)
<da-effect> ::= (when <da-GD> <timed-effect>)

So you can have a plain <timed-effect>, a conjunction of <da-effect> or wrap the <da-effect> in a forall or when (if the :conditional-effects requirement is supported by the planner.)

So technically you can have nested forall too.

<timed-effect> is then defined as follows:

<timed-effect> ::= (at <time-specifier> <cond-effect>)
<timed-effect> ::= (at <time-specifier> <f-assign-da>)
<timed-effect> ::= (<assign-op-t> <f-head> <f-exp-t>)

with <cond-effect> defined as:

<cond-effect> ::= (and <p-effect>*)
<cond-effect> ::= <p-effect>

But <p-effect> does not support conditional-effects:

<p-effect> ::= (not <atomic formula(term)>)
<p-effect> ::= <atomic formula(term)>
<p-effect> ::= (<assign-op> <f-head> <f-exp>)
<p-effect> ::= (assign <function-term> <term>)
<p-effect> ::= (assign <function-term> undefined)

However, interestingly, in the original PDDL2.1 (Fox and Long, 2003) definition <timed-effect> is defined as follows:

<timed-effect> ::= (at <time-specifier> <a-effect>)
<timed-effect> ::= (at <time-specifier> <f-assign-da>)
<timed-effect> ::= (<assign-op-t> <f-head> <f-exp-t>)

Now <a-effect> is not defined anywhere, and it was probably just a typo, where it mostly likely was supposed to be <da-effect>. In which case, the syntax you are trying would have worked.

This mistake got carried forward up to PDDL3.1 and "corrected" to <cond-effect> (presumably instead of <da-effect>), which gives rise to your issue.

jbx
  • 21,365
  • 18
  • 90
  • 144