PDDL nested Conditional Effects

36 views Asked by At

I'm encountering an issue with a particular section of code.

The compiler is indicating a syntax error within the first set of nested "when" conditions, on the 5th line of code. Could be possible that PDDL doesn't accept nested conditions? Is there a potential solution to address this problem?

:effect (and 
                    (when 
                        (and (not (light-on ?room))) 
                        (and (light-on ?room) (when 
                                                (and (vampire-is-in ?room)) 
                                                (and (when 
                                                        (and (not (light-on ?anti-clockwise-neighbor) 
                                                        (and (not(vampire-is-in ?room))(vampire-is-in ?anti-clockwise-neighbor)))))
                                                     (when 
                                                        (and (light-on ?anti-clockwise-neighbor))
                                                        (and (not (vampire-is-in ?room)) (vampire-is-in ?clockwise-neighbor))))))
                    )

                    
                    
                    (when 
                        (and (light-on ?room)) 
                        (and (not (light-on ?room)) (when 
                                                        (and (slayer-is-in ?room)) 
                                                        (and (when 
                                                                (and (light-on ?clockwise-neighbor))
                                                                (and (not (slayer-is-in ?room)) (slayer-is-in ?clockwise-neighbor)))
                                                             (when 
                                                                (and (not (light-on ?clockwise-neighbor)))
                                                                (and (not(slayer-is-in ?room)) (slayer-is-in ?anti-clockwise-neighbor))))))
                    )
        )
1

There are 1 answers

0
Robert P. Goldman On

Looking at the grammar, nested conditional effects are not allowed:

A when expression is as follows:

<c-effect> ::= (when <GD> <cond-effect>)

So only a c-effect can generate a when. But if you look at the expansion of <cond-effect>, it expands to a conjunction of <p-effect>s. I suspect that "p-effect" is supposed to be an abbreviation for primitive effect. A p-effect is effectively a terminal and cannot be expanded to anything containing a c-effect. Ergo nested conditional effects are forbidden.

Of course you can easily flatten your nested conditional effects by making the guard conditions more complex.

Note I base this answer on the PDDL 2.1 paper (with grammar) by Fox and Long. The grammar of conditional effects could have changed since then, but I bet it hasn't.