aiplan4eu / unified-planning

The AIPlan4EU Unified Planning Library
Apache License 2.0
177 stars 39 forks source link

Expression: is not in NNF #612

Open MFaisalZaki opened 2 months ago

MFaisalZaki commented 2 months ago

Describe the bug I'm using the NEGATIVE_CONDITIONS_REMOVING for the schedule domain, and it throws this exception when parsing this

Screenshot 2024-06-23 at 11 55 18 AM

Here is the code to reproduce the bug:


from unified_planning.io import PDDLReader
from unified_planning.shortcuts import Compiler, CompilationKind

domain  = 'domain.pddl'
problem = 'probschedule-2-0.pddl'

task = PDDLReader().parse_problem(domain, problem)
with Compiler(problem_kind = task.kind, 
    compilation_kind = CompilationKind.NEGATIVE_CONDITIONS_REMOVING) as neg_condition_remover:
    ncr_result = neg_condition_remover.compile(task, CompilationKind.NEGATIVE_CONDITIONS_REMOVING)

planning-task.zip

alvalentini commented 1 month ago

Thanks @MFaisalZaki for the bug report! I will have a look asap!

alvalentini commented 1 month ago

The problem here is that the negative conditions remover is not able to remove the negative condition that appears in the exception. At the moment the compiler is only able to remove negation of boolean fluents.

To fix the issue we should reduce the supported problem kind (easy solution) or extend the compiler to handle these kind of negative conditions (more complex).

MFaisalZaki commented 1 month ago

This makes sense. I would suggest keeping this issue open and when the fix is available we can close this issue. What do you think?

alvalentini commented 1 month ago

I agree, thanks.