fast downward will not allow me to have an effect of the following form
(forall (?X - foo)
(when (pred ?X)
(forall (?Y - bar)
....)))
I believe that when parsing, effects.py checks to see if a quantified
effect contains either (a) a simple effect or (b) a conditional effect
(line 170).
Would this be difficult to change?
I have a somewhat oddball reason to request this: in my domain, the
nested FORALL in the above example is generated by a macro. This
permits me to put the same code (representing a single ramification)
in multiple places in my PDDL file. If I am forced to lift the nested
quantifier out above the when (which works), then I cannot use a macro
to repeat the same logic in multiple places. This exposes my PDDL
domain to errors that arise from inconsistencies in multiple copies of
the same logic.
Here's the exact example:
(and
(not (authenticated ?U ?O))
(console_user nobody nouid ?O)
(not (console_user ?H ?U ?O))
(and (forall (?HH - c_host) (not (has_session ?HH ?Sess)))
(forall (?PP - c_process) (not (session_process ?Sess ?PP)))
(forall (?HH - c_human) (not (session_owner ?Sess ?HH))))
(forall (?P - c_process)
(when (session_process ?Sess ?P)
;; this seems to be the problematic line:
(forall (?U - c_uid ?Prog - c_program)
(and (when (euid ?O ?P ?U) (not (euid ?O ?P ?U)))
(when (running_prog ?O ?P ?Prog)
(not (running_prog ?O ?P ?Prog)))
(not (has_process ?O ?P))))))
))
This version parses successfully:
:effect
(and
(not (authenticated ?U ?O))
(console_user nobody nouid ?O)
(not (console_user ?H ?U ?O))
(and (forall (?HH - c_host) (not (has_session ?HH ?Sess)))
(forall (?PP - c_process) (not (session_process ?Sess ?
PP)))
(forall (?HH - c_human) (not (session_owner ?Sess ?HH))))
(forall (?P - c_process ?U - c_uid ?Prog - c_program)
(when (session_process ?Sess ?P)
(and (when (euid ?O ?P ?U) (not (euid ?O ?P ?U)))
(when (running_prog ?O ?P ?Prog)
(not (running_prog ?O ?P ?Prog)))
(not (has_process ?O ?P)))))
))
The logic is that I have a macro that says what it means to kill a
process: remove assertions about its euid, remove the assertion(s)
about the program(s) it runs, and delete it from the list of processes
on a host. I have an operator that kills a session (?Sess), and I
want to quantify over the processes in that session. (Similarly, the
nested conjunction in the above effect is what happens when you expand
the macro that says what it means to kill a session....)
I'm calling this a "feature," although it's arguably a bug: FD is rejecting what
appears to be well-formed PDDL.
|