Skip to content

AI-Planning/fond-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FOND Utilities

Utilities for parsing and manipulating the FOND planning language (those containing non-deterministic oneof effects). At this point the system can:

  • Check a file contains a legal FOND domain/problem.
  • Normalize a FOND planning domain (i.e., have a single top-level oneof clause in the effect).
  • Compute the all-outcome determinization of a FOND domain, where 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.
    • Note the 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 are are based on the SAS translator in Fast-Downard classical planner and produce a SAS encoding of the determinization of a specific instance planning problem. For these determinizers that output SAS encodings, please refer to the individual planners or the translator-fond repo.

Important

The system 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.

Install

The fond-utils system can be installed (as a package) directly from its PyPi repository:

$ pip install fond-utils

Alternatively, it can be installed directly from the repo:

$ pip install git+https://github.com/AI-Planning/fond-utils

or, clone the repository and install:

$ git clone https://github.com/AI-Planning/fond-utils
$ cd fond-utils
$ pip install .

The system already includes a CLI console application fond-utils that will generally be the tool to use. To check the installation was successful just run:

$ fond-utils -h
usage: fond-utils [-h] --input INPUT [--output OUTPUT] [--outproblem OUTPROBLEM] [--prefix PREFIX] [--suffix SUFFIX]
                  [--console]
                  {check,determinize,normalize}

Utilities to process FOND PDDL

positional arguments:
  {check,determinize,normalize}

options:
  -h, --help            show this help message and exit
  --input INPUT         Input domain file
  --output OUTPUT       Output domain file
  --outproblem OUTPROBLEM
                        Optional output problem file
  --prefix PREFIX       Prefix for determinized action outcome identifier (Default: _DETDUP_)
  --suffix SUFFIX       Suffix for determinized action outcome identifier
  --console             Print the domain after processing

Note

The scripts on this system relies on the pddl parser, which can be easily installed via PyPi repository (pip install pddl). The pddl system relies itself on the lark parsing library. The fond-utils system, however, 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

Packages

No packages published