grounding actions with Fast Downward in Python

9 views
Skip to first unread message

Nicholas Rossetti

unread,
Jun 5, 2025, 3:36:27 PMJun 5
to Fast Downward
Hi,
I'm trying to use fast downward as a grounder, and I'm trying to do it in python, is there a command (or python library) that I can use to get the grounded actions given a problem file and get a list of actions?


Informativa sulla Privacy: https://www.unibs.it/it/node/1452

Florian Pommerening

unread,
Jun 10, 2025, 11:52:40 AMJun 10
to fast-d...@googlegroups.com
Hi Nicholas,

you can call just the translator component of Fast Downward by calling

./fast-downward.py --translate domain.pddl problem.pddl

This will generate a file output.sas that contains a grounded version of
the task. However, the grounded representation that Fast Downward uses
is SAS^+ not PDDL (for example using finite-domain variables), so
depending on what you want to use the grounded representation for, this
might not be what you want.

The output.sas file is in a format that is meant to be easy to read by a
parser, so it is not the easiest to read for humans. It is described here:
https://www.fast-downward.org/latest/documentation/translator-output-format/

If you are calling it from a Python process, you could also import the
translator module and call the function yourself (rather than starting a
subprocess and parsing the result). The relevant code for that is here:
https://github.com/aibasel/downward/blob/main/src/translate/translate.py#L702
In particular:
task = pddl_parser.open(...)
normalize.normalize(task)
sas_task = pddl_to_sas(task)


Cheers
Florian


On 5/6/25 19:01, 'Nicholas Rossetti' via Fast Downward wrote:
> Hi,
> I'm trying to use fast downward as a grounder, and I'm trying to do it
> in python, is there a command (or python library) that I can use to get
> the grounded actions given a problem file and get a list of actions?
>
>
> Informativa sulla Privacy: https://www.unibs.it/it/node/1452 <https://
> www.unibs.it/it/node/1452>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Fast Downward" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fast-downwar...@googlegroups.com <mailto:fast-
> downward+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fast-
> downward/18a313e6-f151-4f55-8b8b-a7186b22b785n%40googlegroups.com
> <https://groups.google.com/d/msgid/fast-downward/18a313e6-
> f151-4f55-8b8b-a7186b22b785n%40googlegroups.com?
> utm_medium=email&utm_source=footer>.

Gabriele Röger

unread,
Jun 11, 2025, 5:37:58 AMJun 11
to fast-d...@googlegroups.com
Hi Nicholas,

adding to this:

On 10.06.25 17:52, Florian Pommerening wrote:
> If you are calling it from a Python process, you could also import the
> translator module and call the function yourself (rather than starting a
> subprocess and parsing the result). The relevant code for that is here:
> https://github.com/aibasel/downward/blob/main/src/translate/translate.py#L702
> In particular:
>   task = pddl_parser.open(...)
>   normalize.normalize(task)
>   sas_task = pddl_to_sas(task)

There is an internal intermediate internal format for the grounded task before
the transformation to SAS+. You can get it with:

task = pddl_parser.open(...)
normalize.normalize(task) # it depends on the task whether this step is necessary
_, atoms, actions, goals, axioms, _ = instantiate.explore(task)

The resulting actions will be of class PropositionalAction
(https://github.com/aibasel/downward/blob/main/src/translate/pddl/actions.py#L110).

As an alternative to using Fast Downward directly, you can also have a look at
the unified planning library (https://unified-planning.readthedocs.io/en/latest/).
It can also parse PDDL and ground tasks (using the Fast Downward grounder as one
of several options).

Best,
Gabi

Malte Helmert

unread,
Jun 12, 2025, 5:31:26 AMJun 12
to fast-d...@googlegroups.com
Hi Nicholas,

if you don't want the finite-domain variables that Florian mentioned,
you can disable invariant synthesis in the translator, in which case the
resulting grounded task will only use binary state variables that
correspond to the original grounded atoms of the PDDL task:

./fast-downward.py --translate DOMAIN.pddl PROBLEM.pddl
--translate-options --invariant-generation-max-candidates 0

Best,
Malte

Nicholas Rossetti

unread,
Jul 25, 2025, 9:50:44 AMJul 25
to Fast Downward
Hi everyone,
Thanks to Florian, Gabriele, and Mate for their replies.
I managed to get the grounded actions for my code without any problems.
I was wondering, is it possible to also get all the possible predicates? That way, I could have a bitmap to quickly control the applicable actions.
Best regards

Malte Helmert

unread,
Jul 28, 2025, 7:53:36 AMJul 28
to fast-d...@googlegroups.com
On 25.07.25 13:04, 'Nicholas Rossetti' via Fast Downward wrote:
> Hi everyone,
> Thanks to Florian, Gabriele, and Mate for their replies.
> I managed to get the grounded actions for my code without any problems.
> I was wondering, is it possible to also get all the possible predicates?
> That way, I could have a bitmap to quickly control the applicable
actions.

No, that's not how the planner organizes the information.

Also, what you describe suggests that you want to loop over the possible
actions to determine which ones are applicable. The more efficient
algorithms for checking applicable actions work differently, with some
kind of query structure that has a best-case performance that scales
with the number of applicable actions, not the number of all actions. On
some benchmarks, there are hundreds of thousands of actions, of which
only a very small fraction is applicable on average.

If you want to find out more, look for
task_utils/successor_generator.{cc,h} in the Fast Downward C++ code.

You can find some background in Section 5.3 of this paper:
https://ai.dmi.unibas.ch/papers/helmert-jair06.pdf

Best,
Malte

> Best regards
>
> Il giorno giovedì 12 giugno 2025 alle 11:31:26 UTC+2 Malte Helmert ha
> scritto:
>
> Hi Nicholas,
>
> if you don't want the finite-domain variables that Florian mentioned,
> you can disable invariant synthesis in the translator, in which case
> the
> resulting grounded task will only use binary state variables that
> correspond to the original grounded atoms of the PDDL task:
>
> ./fast-downward.py --translate DOMAIN.pddl PROBLEM.pddl
> --translate-options --invariant-generation-max-candidates 0
>
> Best,
> Malte
>
> On 11.06.25 11:37, Gabriele Röger wrote:
> > Hi Nicholas,
> >
> > adding to this:
> >
> > On 10.06.25 17:52, Florian Pommerening wrote:
> >> If you are calling it from a Python process, you could also
> import the
> >> translator module and call the function yourself (rather than
> starting
> >> a subprocess and parsing the result). The relevant code for that
> is here:
> >> https://github.com/aibasel/downward/blob/main/src/translate/
> translate.py#L702 <https://github.com/aibasel/downward/blob/main/
> src/translate/translate.py#L702>
> >> In particular:
> >>   task = pddl_parser.open(...)
> >>   normalize.normalize(task)
> >>   sas_task = pddl_to_sas(task)
> >
> > There is an internal intermediate internal format for the
> grounded task
> > before the transformation to SAS+. You can get it with:
> >
> > task = pddl_parser.open(...)
> > normalize.normalize(task) # it depends on the task whether this
> step is
> > necessary
> > _, atoms, actions, goals, axioms, _ = instantiate.explore(task)
> >
> > The resulting actions will be of class PropositionalAction
> > (https://github.com/aibasel/downward/blob/main/src/translate/
> pddl/actions.py#L110 <https://github.com/aibasel/downward/blob/main/
> src/translate/pddl/actions.py#L110>).
> >
> > As an alternative to using Fast Downward directly, you can also
> have a
> > look at the unified planning library
> > (https://unified-planning.readthedocs.io/en/latest/ <https://
> unified-planning.readthedocs.io/en/latest/>).
> > It can also parse PDDL and ground tasks (using the Fast Downward
> > grounder as one of several options).
>
>
>
>
>
>
> Informativa sulla Privacy: https://www.unibs.it/it/node/1452 <https://
> www.unibs.it/it/node/1452>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Fast Downward" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fast-downwar...@googlegroups.com <mailto:fast-
> downward+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fast-
> downward/cde0965f-73a9-4c3b-befe-087b1fb0d0e2n%40googlegroups.com
> <https://groups.google.com/d/msgid/fast-downward/cde0965f-73a9-4c3b-
> befe-087b1fb0d0e2n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages