aiplan4eu / unified-planning

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

feat: Allow partially defined initial state #576

Closed arbimo closed 3 months ago

arbimo commented 6 months ago

This PR adds support for undefined values in the initial state.

In essence, it introduces two new problem features that capture whether a problem has numeric/non-numeric state variables with undefined values in the initial state. If one of these features hold, then problem.initial_value(...) may return None.

fix #569 fix #526

todo: Missing the doc for the new features

mikand commented 6 months ago

@arbimo This makes sense, but waht would be the semantics for a problem with uninitailized value? If you remember, engines and validators in PDDL have a wide variety of interpretation of waht is allowed and disallowed...

arbimo commented 6 months ago

The interpretation in this PR (enforced by a test case) is the most conservative one: the evaluation of an expression is undefined if it refers to an undefined value, as per the PDDL spec.

My position on the matter is that we have to allow models with undefined values as their are simply to many benchmarks with those. This issue was already reported 3 times (+2 if you count myself and another PhD at LAAS). For the semantics, we need to pick a "preferred" one and the one from the PDDL spec appears to be the least evil in the absence of a consensus in the community.

hstairs commented 5 months ago

@arbimo I agree but let me try to summarize what I think we are implying here, at least for the numeric case which I think is the more critical. There are two cases. Numeric expressions in conditions and numeric expressions as right-hand side of effects (and let's treat inc and dec as assignment here). Conditions: any numeric expression containing an undefined numeric value in a state s is undefined is s, and the numeric condition that contains it evaluates to false in s. Any formula containing an undefined numeric condition (e.g., \phi = x +y >= 5) as a subformula is false (e.g., state s = {...x = undefined} \not \models \phi) . Numeric effect: any effect x = exp having exp undefined is undefined. An action having at least one undefined effect in s is not applicable. I think this is the closest semantics to PDDL2.1 and also the most conservative one, and hopefully I am not forgetting anything :)

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 93.90244% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 85.34%. Comparing base (ee56971) to head (5915fed).

Files Patch % Lines
...ed_planning/grpc/generated/unified_planning_pb2.py 25.00% 3 Missing :warning:
unified_planning/io/pddl_reader.py 66.66% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #576 +/- ## ========================================== + Coverage 85.28% 85.34% +0.06% ========================================== Files 202 202 Lines 27245 27309 +64 ========================================== + Hits 23237 23308 +71 + Misses 4008 4001 -7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.