JuliaPlanners / PDDL.jl

Julia parser, interpreter and compiler interface for the Planning Domain Definition Language (PDDL). Planners not included.
https://juliaplanners.github.io/PDDL.jl/dev
Apache License 2.0
78 stars 9 forks source link

Error when compiling states #18

Open pevnak opened 1 year ago

pevnak commented 1 year ago

Hi,

I am encountering error when compiling a problem and I would like to know, if this is something trivial to fix or a lack of some feature. Compiler is a bit opaque for me to fix this.

julia> domain = load_domain(domain_pddl)
julia> problem = load_problem(problem_file)
julia> c_domain, c_state = compiled(domain, problem)
ERROR: Unknown datatype: number
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] macro expansion
    @ ~/.julia/packages/PDDL/KzQK5/src/builtins.jl:33 [inlined]
  [3] (::PDDL.var"#224#default_f#112"{Symbol})()
    @ PDDL ~/.julia/packages/ValSplit/MMCz3/src/ValSplit.jl:143
  [4] macro expansion
    @ ./array.jl:0 [inlined]
  [5] _valswitch
    @ ~/.julia/packages/ValSplit/MMCz3/src/ValSplit.jl:95 [inlined]
  [6] datatype_def
    @ ~/.julia/packages/ValSplit/MMCz3/src/ValSplit.jl:145 [inlined]
  [7] generate_field_type(domain::GenericDomain, sig::PDDL.Signature{1})
    @ PDDL ~/.julia/packages/PDDL/KzQK5/src/compiler/state.jl:4
  [8] generate_state_type(domain::GenericDomain, state::GenericState, domain_type::Symbol)
    @ PDDL ~/.julia/packages/PDDL/KzQK5/src/compiler/state.jl:47
  [9] compiled(domain::GenericDomain, state::GenericState)
    @ PDDL ~/.julia/packages/PDDL/KzQK5/src/compiler/compiler.jl:42
 [10] compiled(domain::GenericDomain, problem::GenericProblem)
    @ PDDL ~/.julia/packages/PDDL/KzQK5/src/compiler/compiler.jl:66
 [11] top-level scope
    @ REPL[102]:1
 [12] top-level scope
    @ ~/.julia/packages/CUDA/BbliS/src/initialization.jl:52

The domain and the problem p01.pddl are from https://github.com/AI-Planning/classical-domains/tree/master/classical/agricola-sat18 . I am using latest PDDL 0.2.12. Thanks for help in advance.

Tomas

ztangent commented 1 year ago

Hey Tomas,

I looked at the domain file, and it seems like there are two aspects of the domain that the PDDL.jl compiler currently cannot handle:

  1. The domain makes use of domain constants, which are currently unsupported by the compiler. The workaround here is to add the domain constants as objects to each problem file.
  2. The domain has functions with output type number, but the PDDL.jl compiler currently only handles numeric and integer as output types by default. The workaround here is to change the output types from number to numeric or integer, depending on which makes more sense.

Hopefully those workarounds fix things! In the future, I will probably add support for domain constants in the compiler, and perhaps make number an alias for numeric, so that things work out of the box.

pevnak commented 1 year ago

Thank Xuan for the help. I will give it a try. Tomas