lifted-pddl


Namelifted-pddl JSON
Version 1.2.2 PyPI version JSON
download
home_pagehttps://github.com/AI-Planning/lifted-pddl
SummaryA lightweight framework for parsing PDDL in lifted form.
upload_time2023-06-23 17:21:40
maintainer
docs_urlNone
authorCarlos Núñez Molina
requires_python
licenseMIT
keywords automated_planning pddl parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/lifted-pddl.svg)](https://badge.fury.io/py/lifted-pddl) [![Downloads](https://static.pepy.tech/badge/lifted-pddl)](https://pepy.tech/project/lifted-pddl)

# Lifted PDDL
A lightweight framework for the efficient parsing and manipulation of PDDL. 
It achieves this by working on the PDDL description in its lifted form, i.e., without grounding it first. Lifted PDDL is heavily inspired by the [Powerlifted Planner](https://github.com/abcorrea/powerlifted) but encodes PDDL elements as in [Planning Problem Generation](https://github.com/ari-dasci/S-PlanningProblemGeneration). It provides the following functionality:

 - **Parsing** PDDL domain and problem files and inspecting their information (actions, predicates, types, atoms, objects, etc.)
 - Obtaining the list of **applicable actions** at a given state. It also makes possible to check the applicability of a single ground action.
 - Obtaining the next state resulting from applying an action to the current state (**successor function**).

## Installation

You can install Lifted PDDL as a python package from [PyPI](https://pypi.org):

    pip install lifted-pddl

## Requirements

The only external depency is the `tarski` Python package, which is used to initially parse the PDDL files. It was tested on version number `0.8.2`.

Lifted PDDL was tested on Python 3.8, but should support any version of Python 3. Additionally, it was tested on Windows, but should also work on Linux, Mac and other OS.

## How to use

Lifted PDDL can be used in two different ways.

Firstly, it can be imported as any other Python module and be used within Python:

    from lifted_pddl import Parser
    
    # Parse logistics domain
	parser = Parser()
	parser.parse_domain('data/logistics-domain.pddl')
	print("Parser information after parsing the domain\n", parser)

	# Parse logistics problem
	parser.parse_problem('data/logistics-problem.pddl')
	print("\nParser information after parsing the domain AND problem\n", parser)

	# Obtain actions applicable at the current state (given by logistics-problem.pddl)
	print("\nApplicable actions:\n", parser.get_applicable_actions()) # Average execution time: 0.0007s
	print("\nApplicable actions in PDDL format:\n", parser.encode_ground_actions_as_pddl(parser.get_applicable_actions(), 'str'))

	# Check if individual actions are applicable
	print("\nIs ('drive', (44, 15, 12, 1)) applicable?:", parser.is_action_applicable('drive', (44, 15, 12, 1)))
	print("Is ('drive', (44, 15, 18, 1)) applicable?:", parser.is_action_applicable('drive', (44, 15, 18, 1)))
	print("Is ('unload', (37, 64, 8)) applicable?:", parser.is_action_applicable('unload', (37, 64, 8)))

	# Apply an action at the current state (given by logistics-problem.pddl) and obtain the next state
	print("\nApply action ('drive', (44, 15, 12, 1)) and get next state:\n", parser.get_next_state('drive', (44, 15, 12, 1)))
	print("\nApply action ('drive', (44, 15, 12, 1)) and get next state in PDDL format:\n", parser.encode_atoms_as_pddl(parser.get_next_state('drive', (44, 15, 12, 1)), 'str'))

Secondly, it can be called from the command line. It supports different modes of execution:

- See an example of use (it executes the script above):

		lifted_pddl example

- Parse a planning task and print its information:

		lifted_pddl print_planning_task -d path_to_domain -p path_to_problem

- Get applicable actions:

		lifted_pddl get_applicable_actions -d path_to_domain -p path_to_problem

- Check action applicability:

		lifted_pddl is_action_applicable -d path_to_domain -p path_to_problem -a action_to_apply

- Get next state:

		lifted_pddl get_next_state -d path_to_domain -p path_to_problem -a action_to_apply

## Limitations

At the moment, Lifted PDDL supports the following PDDL extensions:

- Types (`:typing`).

- Existential preconditions (`:existential-preconditions`), i.e., `(exists ...)` constructions in action preconditions.

- Limited support for negative preconditions (`:negative-preconditions`), i.e., `(not ...)` constructions in action preconditions. However,
  negative compound formulas are not supported, i.e., constructions like `(exists (not ...))` and `(not (and ...))`. At the moment, we only support
  negated atoms in preconditions.

In the future, Lifted PDDL will be extended to support ADL and, maybe, other PDDL requirements. We also welcome contributions. The code is brief, simple to understand and has many comments, so I encourage you to implement any functionality you need and submit a pull request to the [Github](https://github.com/AI-Planning/lifted-pddl)! 😄

## Authors

 - [Carlos Núñez Molina](https://github.com/TheAeryan)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/AI-Planning/lifted-pddl",
    "name": "lifted-pddl",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "automated_planning PDDL parser",
    "author": "Carlos N\u00fa\u00f1ez Molina",
    "author_email": "ccaarlos@ugr.es",
    "download_url": "https://files.pythonhosted.org/packages/df/05/930d35f16047831903a1db1d98aeffd1ca520e0aac3078628ad97200a4d0/lifted-pddl-1.2.2.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/lifted-pddl.svg)](https://badge.fury.io/py/lifted-pddl) [![Downloads](https://static.pepy.tech/badge/lifted-pddl)](https://pepy.tech/project/lifted-pddl)\n\n# Lifted PDDL\nA lightweight framework for the efficient parsing and manipulation of PDDL. \nIt achieves this by working on the PDDL description in its lifted form, i.e., without grounding it first. Lifted PDDL is heavily inspired by the [Powerlifted Planner](https://github.com/abcorrea/powerlifted) but encodes PDDL elements as in [Planning Problem Generation](https://github.com/ari-dasci/S-PlanningProblemGeneration). It provides the following functionality:\n\n - **Parsing** PDDL domain and problem files and inspecting their information (actions, predicates, types, atoms, objects, etc.)\n - Obtaining the list of **applicable actions** at a given state. It also makes possible to check the applicability of a single ground action.\n - Obtaining the next state resulting from applying an action to the current state (**successor function**).\n\n## Installation\n\nYou can install Lifted PDDL as a python package from [PyPI](https://pypi.org):\n\n    pip install lifted-pddl\n\n## Requirements\n\nThe only external depency is the `tarski` Python package, which is used to initially parse the PDDL files. It was tested on version number `0.8.2`.\n\nLifted PDDL was tested on Python 3.8, but should support any version of Python 3. Additionally, it was tested on Windows, but should also work on Linux, Mac and other OS.\n\n## How to use\n\nLifted PDDL can be used in two different ways.\n\nFirstly, it can be imported as any other Python module and be used within Python:\n\n    from lifted_pddl import Parser\n    \n    # Parse logistics domain\n\tparser = Parser()\n\tparser.parse_domain('data/logistics-domain.pddl')\n\tprint(\"Parser information after parsing the domain\\n\", parser)\n\n\t# Parse logistics problem\n\tparser.parse_problem('data/logistics-problem.pddl')\n\tprint(\"\\nParser information after parsing the domain AND problem\\n\", parser)\n\n\t# Obtain actions applicable at the current state (given by logistics-problem.pddl)\n\tprint(\"\\nApplicable actions:\\n\", parser.get_applicable_actions()) # Average execution time: 0.0007s\n\tprint(\"\\nApplicable actions in PDDL format:\\n\", parser.encode_ground_actions_as_pddl(parser.get_applicable_actions(), 'str'))\n\n\t# Check if individual actions are applicable\n\tprint(\"\\nIs ('drive', (44, 15, 12, 1)) applicable?:\", parser.is_action_applicable('drive', (44, 15, 12, 1)))\n\tprint(\"Is ('drive', (44, 15, 18, 1)) applicable?:\", parser.is_action_applicable('drive', (44, 15, 18, 1)))\n\tprint(\"Is ('unload', (37, 64, 8)) applicable?:\", parser.is_action_applicable('unload', (37, 64, 8)))\n\n\t# Apply an action at the current state (given by logistics-problem.pddl) and obtain the next state\n\tprint(\"\\nApply action ('drive', (44, 15, 12, 1)) and get next state:\\n\", parser.get_next_state('drive', (44, 15, 12, 1)))\n\tprint(\"\\nApply action ('drive', (44, 15, 12, 1)) and get next state in PDDL format:\\n\", parser.encode_atoms_as_pddl(parser.get_next_state('drive', (44, 15, 12, 1)), 'str'))\n\nSecondly, it can be called from the command line. It supports different modes of execution:\n\n- See an example of use (it executes the script above):\n\n\t\tlifted_pddl example\n\n- Parse a planning task and print its information:\n\n\t\tlifted_pddl print_planning_task -d path_to_domain -p path_to_problem\n\n- Get applicable actions:\n\n\t\tlifted_pddl get_applicable_actions -d path_to_domain -p path_to_problem\n\n- Check action applicability:\n\n\t\tlifted_pddl is_action_applicable -d path_to_domain -p path_to_problem -a action_to_apply\n\n- Get next state:\n\n\t\tlifted_pddl get_next_state -d path_to_domain -p path_to_problem -a action_to_apply\n\n## Limitations\n\nAt the moment, Lifted PDDL supports the following PDDL extensions:\n\n- Types (`:typing`).\n\n- Existential preconditions (`:existential-preconditions`), i.e., `(exists ...)` constructions in action preconditions.\n\n- Limited support for negative preconditions (`:negative-preconditions`), i.e., `(not ...)` constructions in action preconditions. However,\n  negative compound formulas are not supported, i.e., constructions like `(exists (not ...))` and `(not (and ...))`. At the moment, we only support\n  negated atoms in preconditions.\n\nIn the future, Lifted PDDL will be extended to support ADL and, maybe, other PDDL requirements. We also welcome contributions. The code is brief, simple to understand and has many comments, so I encourage you to implement any functionality you need and submit a pull request to the [Github](https://github.com/AI-Planning/lifted-pddl)! \ud83d\ude04\n\n## Authors\n\n - [Carlos N\u00fa\u00f1ez Molina](https://github.com/TheAeryan)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight framework for parsing PDDL in lifted form.",
    "version": "1.2.2",
    "project_urls": {
        "Homepage": "https://github.com/AI-Planning/lifted-pddl"
    },
    "split_keywords": [
        "automated_planning",
        "pddl",
        "parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3a2448613a8be9ca598fbe455fa5a2d57daa2477701d6a183bef9f88e533a92",
                "md5": "9592a740e7d6fd0f388c815642b781d6",
                "sha256": "ac00cf5f705fbc51dcceb1c5dcc0c6d8c0435c094bd930ed927786f50314cb0e"
            },
            "downloads": -1,
            "filename": "lifted_pddl-1.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9592a740e7d6fd0f388c815642b781d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19277,
            "upload_time": "2023-06-23T17:21:36",
            "upload_time_iso_8601": "2023-06-23T17:21:36.022130Z",
            "url": "https://files.pythonhosted.org/packages/c3/a2/448613a8be9ca598fbe455fa5a2d57daa2477701d6a183bef9f88e533a92/lifted_pddl-1.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df05930d35f16047831903a1db1d98aeffd1ca520e0aac3078628ad97200a4d0",
                "md5": "d67d1c78dd4d031cab739239eb7925f2",
                "sha256": "11e5e095f2bf16781f4aaa6513e258f0ea5179db8ad520bfebb6353f6506c46f"
            },
            "downloads": -1,
            "filename": "lifted-pddl-1.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d67d1c78dd4d031cab739239eb7925f2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18449,
            "upload_time": "2023-06-23T17:21:40",
            "upload_time_iso_8601": "2023-06-23T17:21:40.681836Z",
            "url": "https://files.pythonhosted.org/packages/df/05/930d35f16047831903a1db1d98aeffd1ca520e0aac3078628ad97200a4d0/lifted-pddl-1.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-23 17:21:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AI-Planning",
    "github_project": "lifted-pddl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lifted-pddl"
}
        
Elapsed time: 0.08338s