Fast Downward doesn't support using an arithmetic comparison as an action precondition, but the planner Metric-FF does. The latter can be downloaded from here, and it is easy to install:
ensure flex
and bison
are installed on your system; On Ubuntu just use:
sudo apt-get install bison flex
run make
in the source directory
Metric-FF
can be executed as follows :
./ff -o path/to/domain.pddl -f path/to/problem.pddl
To solve the problem in the question, I used a variable cost
to track the time and allowed an action to occur after a certain amount of time has passed.
My code sample is as follows:
- Define a
:predicate
in the domain file, e.g. (cost ?cost)
- Define a
:function
in the domain file, e.g. (:functions (total-cost ?cost))
- Add
(cost)
in the :objects
part of the problem file
- In the
:init
part of the problem file, set the "time" to start as "x", e.g. (= (total-cost ?cost) 0)
where "time" is cost
and "x" is equal to 0
.
- Now it is possible to use the arithmetic comparison in any action precondition; e.g.
(> (total-cost ?cost) x)
, where x
can be set to any value (including floating point numbers); Note that in this case ?cost
must be included in the :parameters
section of the said action
- Finally, the value of
total-cost
can be increased (resp. decreased) after every action execution with (increase (total-cost ?cost) x)
(resp. (decrease (total-cost ?cost) x)
), where x
can again be replace with any value.