Consider the following generic structure for a PDDL2.1 durative action, excluding the use of duration inequalities and continuous effects. Conditional effects are ignored, since they can be handled by flattening the actions as described in Core Definition 5. The complication of conditional effects that combine initial and final conditions is discussed in [Fox LongFox Long2003] and does not affect the basic principles we demonstrate in the translation we give here. Similarly, for convenience, we do not consider duration constraints referring to the end state -- extension of the treatment below to manage these constraints is straightforward.
:duration (= ?duration )
:condition (and (at start ) (at end ) (over all ))
:effect (and (at start )(at end ?duration))
We now construct the following structures in PDDL+:
:precondition (and (not (_clock_started )))
(assign (_clock ) 0)
(assign (_duration ) )
(increase (clock_count) 1))
:precondition (_clock_started )
:effect (increase (_clock ) (* #t 1))
:precondition (and (_clock_started )
(not (= (_clock ) (_duration )))
:effect (assign (_clock ) (+ (_duration ) 1)))
:precondition (and (_clock_started )
(= (_clock ) (_duration )))
:effect (and (_duration )
(not (_clock_started ))
(decrease (clock_count) 1)))
To complete the transformation, the initial state has the (= (clock_count) 0) added to it and the goal has the condition (= (clock_count) 0) added to it.
Note that the clock is uniquely determined by the name and arguments of the durative action, so the clock is not shared between different durative actions. Also note that there is only one action that can start each such clock and only one that can terminate it. If a plan makes use of the durative action then in the transformed domain the durative action can be simulated by the actions that start and stop the clock. In order for these actions to execute successfully the conditions must be identical to those stipulated in the durative action and their effects are equivalent to the original durative action. Furthermore, the end action can only be executed once the clock has reached the correct duration value (which is recorded at the start). The clock is driven by a process that is active only once the start action has been executed and only until the end action is executed. An event is used to monitor the invariant conditions. If ever the invariant becomes false while the clock is running then the event sets the clock to be after the duration of the durative action. This makes it impossible to complete the action and terminate the clock, so that no valid execution trace can be constructed to achieve the goal in which the event is triggered. Every time a clock starts a count is incremented and it is decremented when a clock stops. The count must be zero at the end, meaning that every clock must have stopped and therefore every durative action must have been ended before the plan is complete.
The duration of the action is managed by using a metric fluent to store the duration at the outset in order to use the value at the conclusion of the action. If the value is a fixed constant then this can be simplified by replacing the metric fluent with the appropriate constant.
Packaging actions, events and processes into a durative action abstracts the details of how the interval ends -- whether by an action or by an event. For example, if a durative action is used to represent the activity of filling a bath, its end point will represent the action of turning off the taps, whilst in a durative action representing a ball being dropped, the end of the action is the event of the ball landing. However, there is no syntactic difference between the structures encoding these examples that allows a distinction to be drawn between an end point that is an action and one that is an event. The mapping of durative actions into actions, processes and events requires an arbitrary decision to be made about how to handle the end points of durative actions. While we have chosen to use actions, an alternative formulation is possible using events.
The mapping converts every durative action into the family of PDDL+ constructs shown above -- two actions to start and end the interval, a process to execute during the interval,and a monitoring event for the invariant. Because an action is always used to end the interval a planner must always choose to apply it in order to obtain a goal state. In the final plan the terminating action will appear, chosen by the planner, even though its application is in fact forced, and its point of application must be consistent with the duration constraint of the original durative action. Thus, although the planner is free to choose whether and when to apply the action, in order to construct a valid plan it is forced to apply the action at a point that exactly meets the appropriate temporal constraints. Of course, the end points of the simulated durative actions can be trivially post-processed to make a plan containing durative actions instead of to their underlying components.Derek Long 2006-10-09