In PDDL, how can I access time since *start* as a variable?

169 views Asked by At

I know that in durative effects, I can compute based on #t, which is some flavor of elapsed time. But from the examples I see, it seems to be more like the duration of the effect itself: for instance, boil water, and heat it by a certain amount for the time it boils. Whereas, I want to have a cost that factors in total elapsed time since the start of the entire plan. Is that a different variable?

I tried (increase (total-cost) (* #t (num-not-yet-fixed ?group))) Where the num-not-yet-fixed goes down over time, and the idea is to increase the cost by a higher value if more things being "fixed" are fixed later rather than earlier. But (a) popf rejected the use of #t here, it seems, and (b) it seems like even if it worked, it would be for the fixed duration of the durative effect, and not since the start of execution.

1

There are 1 answers

29
haz On BEST ANSWER

Any chance you can create a new function, say (now), that starts at 0, is added to linearly over time via a full-plan envelope action, and then used by the other actions to refer to things?

Something like this...

(:durative-action measure-time
 :precondition (begin)
 :effect (and
   (at start (going))
   (at start (not (begin)))
   (at end (not (going)))
   (increase (now) #t)
 )

; all other actions have a condition (over all (going))

; any action that needs to refer to the current time in the plan can use the function (now)

...and the init would have:

; used so that the measure-time happens only once
(begin)

; a function to measure the current time and use in an action
(= (now) 0)

...and the goal should be modified to also include (not (going))