PDDL+ Planning: Processes and Events
PDDL+ Planning: Processes and Events
Copyright By PowCoder代写 加微信 powcoder
So far we have seen actions with linear continuous numeric effects:
(increase (battery) (* #t 1))
Now we are going to look at the more advanced features of PDDL+:
Continuous non-linear effects;
Processes and events.
Continuous Non-Linear Effects
In PDDL we can actually write expressions of the form:
dv/dt = P(t)/Q(t) where P and Q are polynomials over the variables defined in the planning problem.
This allows us to write, amongst other things:
Polynomials;
Exponential functions;
Logarithmic functions.
PDDL2.1: Ball Drop Example
PDDL2.1 adds durative actions to PDDL
But as we now know actions can include continuous numeric effects and variable durations
(:durative-action drop-ball
:parameters (?b – ball)
:duration (> ?duration 0)
:condition (and (at start (holding ?b)) (at start (= (velocity ?b) 0)))
:effect (and (at start (not (holding ?b)))
(decrease (height ?b) (* #t (velocity ?b)))
(increase (velocity ?b) (* #t (gravity)))))
Notice how the two continuous effects interact
h = -vt = -gt2
PDDL2.1: Dropping the ball
What happens if there is a floor?
Duration of the drop-ball action is limited by the distance to the floor…
(:durative-action drop-ball
:parameters (?b – ball)
:duration (> ?duration 0)
:condition (and (at start (holding ?b)) (at start (= (velocity ?b) 0))
(over all (>= (height ?b) 0)))
:effect (and (at start (not (holding ?b)))
(decrease (height ?b) (* #t (velocity ?b)))
(increase (velocity ?b) (* #t (gravity)))))
But what happens if we leave the ball to fall?
PDDL+: Let’s see it bounce
A “better” model is to see releasing the ball as separated from the fate of the ball after it falls
Release initiates a process of falling
The falling process can be terminated by various possible actions (catching, hitting, …) or events (bouncing)
PDDL+: Processes and Events
Executive agents perform actions that change the world state in some way
Processes execute continuously under the direction of the world
The world decides whether a process is active or not
Events are the world’s version of actions: the world performs them when conditions are met
Planning is about deciding which actions the executive agents should perform by anticipating the effects of actions before they are executed
Requires a way to predict what will happen when actions are performed (and also when they are not)
What makes it hybrid?
When actions or events are performed they cause instantaneous changes in the world
These are discrete changes to the world state
When an action or an event has happened it is over
Processes are continuous changes
Once they start they generate continuous updates in the world state
A process will run over time, changing the world at every instant
Holding ball
Action: drop ball
Not holding ball
Ball falling
Height over time
Problem Features
We might care about how much of the effect of a process is generated, so we want to choose how long to let it run
Running a bath
Mixing chemicals or running reactions
Heating or cooling metals in a foundry
Duration-dependent effects
We might need to interact with a process while it runs, exploiting or managing conditions during execution
Required concurrency with process effects
PDDL+: Let’s see it bounce
A “better” model is to see releasing the ball as separated from the fate of the ball after it falls
Release initiates a process of falling
The falling process can be terminated by various possible actions (catching, hitting, …) or events (bouncing)
How does this look in PDDL+
PDDL+: Let it go
First drop it…
Then watch it fall…
(:action release
:parameters (?b – ball)
:precondition (and (holding ?b) (= (velocity ?b) 0))
:effect (and (not (holding ?b))))
(:process fall
:parameters (?b – ball)
:precondition (and (not (holding ?b)) (>= (height ?b) 0)))
:effect (and (increase (velocity ?b) (* #t (gravity)))
(decrease (height ?b) (* #t (velocity ?b)))))
Process has a precondition
Happens when this is satisfied
No matter what, we don’t
have a choice
Continuous numeric effects,
No discrete effects.
PDDL+: See it bounce
Bouncing…
Now lets plan to catch it…
(:event bounce
:parameters (?b – ball)
:precondition (and (>= (velocity ?b) 0)
(<= (height ?b) 0))
:effect (and (assign (height ?b) (* -1 (height ?b)))
(assign (velocity ?b) (* -1 (velocity ?b)))))
(:action catch
:parameters (?b - ball)
:precondition (and (>= (height ?b) 5) (<= (height ?b) 5.01))
:effect (and (holding ?b) (assign (velocity ?b) 0)))
Event has a precondition,
happens when this is satisfied
No matter what, we don’t
have a choice
Discrete numeric effects,
can also have propositional
No continuous effects.
A Valid Plan
Let it bounce, then catch it...
What does the validator say?
Use -l to get a nice latex report showing triggering of processes and events and the values of numeric variables during the plan.
0.1: (release b1)
4.757: (catch b1)
0.1: (release b1)
4.757: (catch b1)
VAL Report
Height of the Ball is Quadratic
0.1: (release b1)
4.757: (catch b1)
Velocity is Linear but Discontinuous
0.1: (release b1)
4.757: (catch b1)
What happens if the ball is not perfectly elastic?
Modify the bounce event slightly...
Notice that the coefficient of restitution is given a –ve sign to make it easier to use!
Notice further that the precondition on height is slightly relaxed to allow bouncing to happen until the ball is too close to bounce any more...
(:event bounce
:parameters (?b - ball)
:precondition (and (>= (velocity ?b) 0)
(<= (height ?b) 0.00001))
:effect (and (assign (velocity ?b) (* (coeffRest ?b) (velocity ?b)))))
What happens if the ball is not perfectly elastic?
(:event bounce
:parameters (?b - ball)
:precondition (and (>= (velocity ?b) 0)
(<= (height ?b) 0.00001))
:effect (and (assign (velocity ?b) (* (coeffRest ?b) (velocity ?b)))))
14 bounces!
Zeno behaviour
If we look closely at the bouncing ball, we see that eventually the events are so close (in an idealised view, at least) that infinitely many bounces happen in a finite time
This is Zeno behaviour and it is A Bad Thing
Cannot reason about infinite events in finite time in planner, validator or pretty much anywhere else...
Check the VAL report
This is where we see events getting too close
Cascading events
Events (and processes) can be problematic in lots of interesting ways
It is easy to set up events that trigger each other:
Imagine a light connected to a light-sensitive switch, so that when the light is on it triggers an event which turns the light off...
But, when the light is off an event is triggered that turns it on!
Other Semantic Issues
Events with strict inequality preconditions can create an interesting problem
When does E occur?
At time 10, (x) = 10, so the precondition of E is not satisfied
At time 10+, for any >0, the precondition is satisfied, but it was satisfied at 10+/2 and so E should trigger before 10+
:precondition (> 10 (x))
:effect (and (not (active)) (explode)))
(:process P
:precondition (active)
:effect (increase (x) (* #t 1)))
:init (= (x) 0) (active)
PDDL+ Planning: Example 2 Planetary Lander
Durative Action
Prepare Obs 1
Prepare Obs 2
Fullprepare
Planetary DDL+ model [Fox&Long, JAIR 2006]
generating()
charging()
discharging()
As a case study, we considered the Planetary Lander Domain.
We have a Solar-powered lander.
Basically, it must perform two observation actions, called Observe1 and Observe2. (animazione)
However, before making each observation, it must perform the corresponding preparation task, called prepareObs1 and prepareObs2, respectively. (animazione)
Alternatively, the probe may choose to perform a cumulative preparation task for both observations by executing the single long action fullPrepare. The shorter actions have higher power requirements than the single preparation action.
(animazione)
During the plan execution, Beagle can use the energy generated by the sunlight (process generating) to perform actions immediately or use it to charge the battery (process charge). If no energy is available Beagle uses the battery ones.
In the general theory of universal planning, the concept of start state is not present. However, the concept of reachable state implies such a start state. In particolar, this is very important for model checking algorithms. In other words, we need to start-up the universal planning with a set of start states, that we call start state cloud.
In this experiment, we generated the start state cloud by varying the initial battery charge and the daytime. In fact, these variables define the environmental conditions.
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
…then use processes to model the continuous change due to the triggered events
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (* (solar_const) (daytime))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
…then use processes to model the continuous change due to the triggered events
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (* (solar_const) (daytime))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
…then use processes to model the continuous change due to the triggered events
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (* (solar_const) (daytime))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
…then use processes to model the continuous change due to the triggered events
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
(:process night_operations
:parameters ()
:precondition (not (day))
:effect (and (decrease (soc) (* #t (heater_rate))) (increase (daytime) (* #t 1)))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (solar_const) (daytime))))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Use events to model discrete changes in the world…
…then use processes to model the continuous change due to the triggered events
(:event daybreak
:parameters ()
:precondition (and (not (day))
(>= (daytime) 0))
:effect (day))
(:event nightfall
:parameters ()
:precondition (and (day) (>= (daytime) (dusk)))
:effect (and (assign (daytime) (- (dawn)) )
(not (day))))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (solar_const) (daytime))))
(increase (daytime) (* #t 1)))
(:process night_operations
:parameters ()
:precondition (not (day))
:effect (and (decrease (soc) (* #t (heater_rate))) (increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Processes allow an easy modelling of concurrency and interactions…
(:process charging
:parameters ()
:precondition (and (day)
(< (demand) (supply)))
:effect (and (increase (soc)
(* #t (* (beta) (- (supply) (demand)))
(:process night_operations
:parameters ()
:precondition (not (day))
:effect (and (decrease (soc) (* #t (heater_rate))) (increase (daytime) (* #t 1)))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (solar_const) (daytime))))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Processes allow an easy modelling of concurrency and interactions...
(:process charging
:parameters ()
:precondition (and (day)
(< (demand) (supply)))
:effect (and (increase (soc)
(* #t (* (beta) (- (supply) (demand)))
(:process discharging
:parameters ()
:precondition (> (demand) (supply))
:effect (decrease (soc) (* #t (- (demand) (supply))))
(:process night_operations
:parameters ()
:precondition (not (day))
:effect (and (decrease (soc) (* #t (heater_rate))) (increase (daytime) (* #t 1)))
(:process generating
:parameters ()
:precondition (day)
:effect (and (increase (supply)
(* #t (* (solar_const) (daytime))))
(increase (daytime) (* #t 1)))
Planetary Lander: PDDL+ domain
Planetary Lander: PDDL+ domain
And now let’s see what the planner can choose to do…
(:durative-action fullPrepare
:parameters ()
:duration (= ?duration fullprepare_durtime)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) (A_rate))) (at end (decrease (demand) (A_rate)))
(at end (readyForObs1)) (at end (readyForObs2))))
(:durative-action fullPrepare
:parameters ()
:duration (= ?duration fullprepare_durtime)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) (A_rate))) (at end (decrease (demand) (A_rate)))
(at end (readyForObs1)) (at end (readyForObs2))))
Planetary Lander: PDDL+ domain
And now let’s see what the planner can choose to do…
(:durative-action prepareObs1
:parameters ()
:duration (= ?duration (prepobs1_durtime))
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) (B_rate)))
(at end (decrease (demand) (B_rate)))
(at end (readyForObs1))))
Note that the change in the demand
here is a discrete change !
(:durative-action prepareObs2
:parameters ()
:duration (= ?duration (prepobs2_durtime))
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) (C_rate)))
(at end (decrease (demand) (C_rate)))
(at end (readyForObs2))))
(:durative-action fullPrepare
:parameters ()
:duration (= ?duration fullprepare_durtime)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) (A_rate))) (at end (decrease (demand) (A_rate)))
(at end (readyForObs1)) (at end (readyForObs2))))
Planetary Lander: PDDL+ domain
And now let’s see what the planner can choose to do…
(:durative-action prepareObs1
:parameters ()
:duration (= ?duration (prepobs1_durtime))
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) (B_rate)))
(at end (decrease (demand) (B_rate)))
(at end (readyForObs1))))
These actions cannot be executed
in parallel
(:durative-action prepareObs2
:parameters ()
:duration (= ?duration (prepobs2_durtime))
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) (C_rate)))
(at end (decrease (demand) (C_rate)))
(at end (readyForObs2))))
(:durative-action fullPrepare
:parameters ()
:duration (= ?duration 5.0)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) 4.0)) (at end (decrease (demand) 4.0))
(at end (readyForObs1)) (at end (readyForObs2))))
Planetary Lander: PDDL+ domain
And now let’s see what the planner can choose to do…
(:durative-action prepareObs1
:parameters ()
:duration (= ?duration 2.0)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) 2.4))
(at end (decrease (demand) (B_rate)))
(at end (readyForObs1))))
(:durative-action prepareObs2
:parameters ()
:duration (= ?duration 2.0)
:condition (and (at start (available unit))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit)))
(at end (available unit))
(at start (increase (demand) 2.9))
(at end (decrease (demand) (C_rate)))
(at end (readyForObs2))))
Planetary Lander: PDDL+ domain
Now we are ready to make the observations…
(:durative-action observe1
:parameters ()
:duration (= ?duration obs1Time)
:condition (and (at start (available unit))
(at start (readyForObs1))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) (obs1-rate)))
(at end (decrease (demand) (obs1-rate)))
(at end (gotObs1))))
(:durative-action observe2
:parameters ()
:duration (= ?duration obs2Time)
:condition (and (at start (available unit))
(at start (readyForObs2))
(over all (> (soc) (safelevel))))
:effect (and (at start (not (available unit))) (at end (available unit))
(at start (increase (demand) (obs2-rate)))
(at end (decrease (demand) (obs2-rate)))
(at end (gotObs2))))
Battery state of charge
The last step is the evaluation of the generated plans.
To this end, we used the well-known validator VAL.
Moreover, to estimate the precision of the plans, the tool compares the variables values computed by VAL during the validation process with the values computed during the generation process.
The table shows the normalized root mean square error for the nonlinear variables involved in the problem.
Note that, the average values are small, so the chosen discretization is good.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com