Skip to content

AI-Planning/fond-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FOND Utilities

Utilities for parsing and manipulating the FOND planning language.

In the all-outcome determinization, each non-deterministic action is replaced with a set of deterministic actions, each encoding one possible effect outcome of the action. A solution in the deterministic version amounts to a weak plan solution in the original FOND problem.

Important

The determinizer accepts effects that are an arbitrary nesting of oneof, conditional effects, and and. See section Format allowed on effects at the bottom about format accepted.

Note

This determinizer produces another PDDL domain and does not deal with the problem itself, unlike the SAS-based determinizers used in other planners like PRP, FONDSAT, or CFOND-ASP that produces a SAS encoding of the determinization of a specific instance planning problem and are based on the SAS translator in Fast-Downard classical planner. For these determinizers that output SAS encodings, please refer to the individual planners or the translator-fond repo.

Pre-requisites

The script relies on the pddl parser, which can be easily installed via:

$ pip install pddl

The pddl system relies itself on the lark parsing library.

This repo extends pddl to accept single files containing both the domain and the problem instance, and will be extended further to accept labelled outcomes in the effects.

Example runs

The system is provided as a module fondutils. To just check that the PDDL input file is parsed well, use the command check and report to console:

$ python -m fondutils check --input tests/domain_03.pddl

To simply perform normalization (i.e., have a single top-level oneof clause in the effect):

$ python -m fondutils normalize --input tests/domain_05.pddl --output normalized-domain.pddl

Example test/domain_05.pddl includes some complex (nested) oneof effects. The name of the normalized domain will be the original name with suffix _NORM.

To perform the determinization, use the command determinize:

$ python -m fondutils determinize --input tests/domain_03.pddl --output determinized-domain.pddl

The name of the determinized domain will be the original name with suffix _ALLOUT.

By default, deterministic versions of non-deterministic actions will be indexed with term __DETDUP_<n> (as done by PRP's original determinizer).

Tip

To change the default prefix _DETDUP_ use the options --prefix, and to add a suffix after the number, use --suffix. To get the resulting PDDL printed on console use --console:

$ python -m fondutils determinize --input tests/domain_03.pddl --suffix "_SUF_" --prefix "_PRE_" --console
(define (domain blocks-domain_ALLOUT)
    (:requirements :equality :typing)
    (:types block)
    (:predicates (clear ?b - block)  (emptyhand) (holding ?b - block)  (on ?b1 - block ?b2 - block)  (on-table ?b - block))
    (:action pick-up_PRE_1_SUF_
        :parameters (?b1 - block ?b2 - block)
        :precondition (and (not (= ?b1 ?b2)) (emptyhand) (clear ?b1) (on ?b1 ?b2))
        :effect (and (holding ?b1) (clear ?b2) (not (emptyhand)) (not (clear ?b1)) (not (on ?b1 ?b2)))
    )
     (:action pick-up_PRE_2_SUF_
        :parameters (?b1 - block ?b2 - block)
        :precondition (and (not (= ?b1 ?b2)) (emptyhand) (clear ?b1) (on ?b1 ?b2))
        :effect (and (clear ?b2) (on-table ?b1) (not (on ?b1 ?b2)))
    )
     (:action pick-up_PRE_3_SUF_
        :parameters (?b1 - block ?b2 - block)
        :precondition (and (not (= ?b1 ?b2)) (emptyhand) (clear ?b1) (on ?b1 ?b2))
        :effect (and )
    )
     (:action put-down
        :parameters (?b - block)
        :precondition (holding ?b)
        :effect (and (on-table ?b) (emptyhand) (clear ?b) (not (holding ?b)))
    )
)
...

This resulting PDDL domain is now deterministic and can then be used as input to the original Fast-Downard SAS translator.

Note

The tool python -m fondutils normalize --input tests/domprob_05.pddl --output tea.pddl --outproblem tea2.pddl

Format allowed on effects

The determinizer accepts effects that are an arbitrary nesting of oneof, conditional effects, and and.

If the effect is just one oneof clause, then it corresponds to the Unary Nondeterminism (1ND) Normal Form without conditionals in:

When there are many oneof clauses in a top-level and effect, the cross-product of all the oneof clauses will determine the deterministic actions.

Authors

About

Utilities for parsing + processing FOND domains.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published