Closed marcofavorito closed 5 months ago
Hi @fenjenahwe, I tried to install the library in a fresh virtual environment (Python 3.10.12). I installed pddl
at the latest version at the time of writing, which is 0.4.0
.
The above code gave me the expected outcome, follows a screenshot:
Please, @fenjenahwe, can you provide more details on your environment (i.e., operating system, Python version, pddl
version...) ? It would be greatly appreciated to better understand the issue you are having.
Also, the result can be parsed correctly:
from pathlib import Path
from pddl.core import Domain, Requirements
from pddl.formatter import domain_to_string
from pddl import parse_domain
requirements = [Requirements.STRIPS, Requirements.TYPING, Requirements.NEG_PRECONDITION]
types = {
"A": "B",
"B": "C",
"C": None
}
domain = Domain("example",
requirements=requirements,
types=types
)
# write domain to file
Path("example.pddl").write_text(domain_to_string(domain))
# parse the domaion
actual_domain = parse_domain(Path("example.pddl"))
print(domain_to_string(actual_domain))
print("Original domain types:")
print(types)
print("Parsed domain types:")
print(actual_domain.types)
The output of the above code snippet is:
(define (domain example)
(:requirements :negative-preconditions :strips :typing)
(:types A - B B - C C)
)
Original domain types:
{'A': 'B', 'B': 'C', 'C': None}
Parsed domain types:
{'A': 'B', 'B': 'C', 'C': None}
Thanks @marcofavorito
My environment details are: OS: Ubuntu 22.04.4 Python version: 3.10.12
While reinstalling the library in a new environment, I noticed I had been installing pddl version 0.2.0 This must be the reason, my apologies. I will try with the newest library version and report back if it doesn't solve it.
Perfect, thank you so much! If you don't mind, please let us know when you tried so we can be sure it is not an issue.
I confirm! This solved it. Thanks a lot for helping so quickly and sorry for the oversight.
Perfect! No worries :)
Subject of the issue
This issue has been created to investigate more on several issue the user @fenjenahwe is experiencing with the library. Some of the issues the user encountered have been reported in the comments of issue #98, and they are about the formatting of domains with a non-flat hierarchy of types.
The user reported in this comment that the following code:
Prints:
Whereas the expected behaviour is something like: