Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse domain and problem separately #15

Open
maichmueller opened this issue Oct 2, 2024 · 2 comments
Open

Parse domain and problem separately #15

maichmueller opened this issue Oct 2, 2024 · 2 comments

Comments

@maichmueller
Copy link
Contributor

Currently the only way to parse a problem is to parse the problem together with the domain. But when parsing a list of problems one wouldn't need to re-parse the domain everytime, but could reuse the parsed domain object.

Is it possible with the current parser to set this up? I am thinking of an API like this:

domain = PDDLParser(domain_path).get_domain()

for prob_path in prob_fname_list:
    prob_parser = PDDLParser(domain, problem_path)
    problem, factory = prob_parser.get_problem(), prob_parser.get_pddl_factories()
    ...
@simon-stahlberg
Copy link
Owner

simon-stahlberg commented Oct 3, 2024

Currently, the approach you're suggesting isn’t possible, although we agree that the proposed interface is more elegant than the one in use.

The memory management for problem instances is tightly integrated with the domain instance. For example, domain constants are stored alongside problem objects. While it's technically feasible to separate them, the current approach is only marginally more verbose, and we don’t foresee any significant benefits from the improved interface. Do you have any specific use cases in mind where this change would have a notable impact? If not, we’re inclined not to prioritize this change.

@maichmueller
Copy link
Contributor Author

The use case is mostly the more intuitive API (+ insignificant performance improvements I would imagine). So far, it has only come up in a project where I am parsing multiple problems of the same domain to convert them to graphs, while doing some sanity checks. This is not really an urgent issue, was mostly wondering whether the API choice is deliberate for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants