Skip to content

Parsed problem is inconsistent with its creator #693

Description

@DianLiI

Describe the bug
p2 = PDDLReader().parse_problem(PDDLWriter(p1).get_domain(), None) can produce a p2 that's different from p1.

As a matter of fact, it seems like anything defined with (:function) is always parsed as real fluent regardless of its usage.

To Reproduce

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

Counter = UserType('Counter')
value = Fluent('value', IntType(), m=Counter)

inc = InstantaneousAction('increment',c=Counter)
c = inc.parameter('c')
inc.add_precondition(LE(value(c), 10))
inc.add_increase_effect(value(c), 1)

problem = Problem('problem')

problem.add_fluent(value, default_initial_value=1)
C0 = Object('c0', Counter)
problem.add_object(C0)
problem.add_action(inc)
p2 = PDDLReader().parse_problem_string(PDDLWriter(problem).get_domain())
print("Original problem:")
print(problem.kind)
print("Parsed problem:")
print(p2.kind, "<-- this is different")

Output:

Original problem:
PROBLEM_CLASS: ['ACTION_BASED']
PROBLEM_TYPE: ['SIMPLE_NUMERIC_PLANNING']
EFFECTS_KIND: ['INCREASE_EFFECTS']
TYPING: ['FLAT_TYPING']
FLUENTS_TYPE: ['INT_FLUENTS']
Parsed problem:
PROBLEM_CLASS: ['ACTION_BASED']
PROBLEM_TYPE: ['SIMPLE_NUMERIC_PLANNING']
EFFECTS_KIND: ['INCREASE_EFFECTS']
TYPING: ['FLAT_TYPING']
FLUENTS_TYPE: ['REAL_FLUENTS'] <-- this is different

Expected behavior
problem -> PDDLWriter -> problem_str -> PDDLReader -> problem should not create discrepancies.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions