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

How clear the UP envrionment before each planning task? #478

Open
MFaisalZaki opened this issue Aug 22, 2023 · 8 comments
Open

How clear the UP envrionment before each planning task? #478

MFaisalZaki opened this issue Aug 22, 2023 · 8 comments

Comments

@MFaisalZaki
Copy link

MFaisalZaki commented Aug 22, 2023

How to clear the environment after each loop to avoid having this error:
Screenshot from 2023-08-22 15-54-15

All that I do is iterate on a dictionary containing planning problems:

for planning_task in planning_tasks:
        _planning_task = PDDLReader(None).parse_problem(planning_task['domain'], planning_task['problem'])

I tried disabling the flag using the following:

up.shortcuts.get_environment().error_used_named = True

and the script stopped running.

@MFaisalZaki MFaisalZaki changed the title Can't convertt groundd plan into its lifted version Can't convert grounded plan into its lifted version Aug 22, 2023
@MFaisalZaki MFaisalZaki changed the title Can't convert grounded plan into its lifted version How to get rid of the Aug 22, 2023
@MFaisalZaki MFaisalZaki changed the title How to get rid of the How clear the UP envrionment before each planning task? Aug 22, 2023
@alvalentini
Copy link
Member

@MFaisalZaki can you attach the PDDL files?

@MFaisalZaki
Copy link
Author

Sure, here are the files.
freecell-strips-typed.zip

@alvalentini
Copy link
Member

Try with this code:

from unified_planning.shortcuts import get_environment
get_environment().error_used_name = False

@alvalentini
Copy link
Member

@MFaisalZaki Does it solve your problem?

@MFaisalZaki
Copy link
Author

@alvalentini sorry I did not have time to check it, but I plan to check your suggestion this week, and I'll keep you posted.

@MFaisalZaki
Copy link
Author

@alvalentini, sorry for the late reply. Yeah, this flag works.

@MFaisalZaki
Copy link
Author

Hi @alvalentini,

I'm sorry for reopening this issue again. But I still get this error even after setting the flag to False.

from unified_planning.io import PDDLReader
from unified_planning.shortcuts import *

up.shortcuts.get_environment().error_used_name = False

domainfile = 'domain.pddl'
problemfile = 'problem.pddl'

task = PDDLReader().parse_problem(domainfile, problemfile)

bug

Here are the files to reproduce: bug.zip

Thanks.

@alvalentini
Copy link
Member

Hi @MFaisalZaki! In this case you have the name p3 used for multiple Objects. This is not allowed even if you set the flag error_used_name to False.

With the flag set to False is only possible to use the same name for different elements of the problem (e.g. an Object and an Action).

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