:derived example failure
Closed this issue · 4 comments
helen-of-troy commented
This is the same as https://github.com/nergmada/eviscerator/blob/master/pddl/pddl22/domain-derived-predicates.pddl and https://github.com/nergmada/eviscerator/blob/master/pddl/pddl22/problem-derived-predicates.pddl
domain = @pddl("
(define
(domain simple)
(:requirements :strips :derived-predicates)
(:predicates
(object-is-ready ?a)
(parta-task-complete ?a)
(partb-task-complete ?a)
(task-complete ?a)
)
(:action action1
:parameters (?obj)
:precondition (and
(object-is-ready ?obj)
)
:effect (and
(parta-task-complete ?obj)
)
)
(:action action2
:parameters (?obj)
:precondition (and
(object-is-ready ?obj)
)
:effect (and
(partb-task-complete ?obj)
)
)
(:derived
(task-complete ?obj) (and (parta-task-complete ?obj) (partb-task-complete ?obj))
)
)
")
GenericDomain
name: simple
predicates: Dict{Symbol, PDDL.Signature} with 4 entries
Symbol("object-is-ready") => (object-is-ready ?a)
Symbol("parta-task-complete") => (parta-task-complete ?a)
Symbol("partb-task-complete") => (partb-task-complete ?a)
Symbol("task-complete") => (task-complete ?a)
axioms: Dict{Symbol, Clause} with 1 entry
Symbol("task-complete") => (:derived (task-complete ?obj) (and (parta-task-complete ?obj) (partb-task-complete ?obj)))
actions:
:action1 => (action1 ?obj)
:action2 => (action2 ?obj)
problem = @pddl("
(define
(problem simpleproblem)
(:domain simple)
(:objects
obj1
)
(:init
(object-is-ready obj1)
)
(:goal (and
(task-complete obj1)
))
)
")
GenericProblem
name: simpleproblem
objects: 1-element Vector{Const}
obj1
init: 1-element Vector{Term}
(object-is-ready obj1)
goal: (and (task-complete obj1))
# Construct initial state from domain and problem
state = initstate(domain, problem)
GenericState
objects: 1 (untyped)
obj1
fluents: 1 (boolean)
(object-is-ready obj1) => true
# Construct goal specification that requires minimizing plan length
spec = MinStepsGoal(problem)
MinStepsGoal(Term[task-complete(obj1)])
# Construct A* planner with h_add heuristic
planner = AStarPlanner(HAdd())
ForwardPlanner{Nothing}(HAdd(sum, precomputed=false), nothing, 1.0f0, 1.0f0, 9223372036854775807, Inf, false, false, false, nothing)
# Find a solution given the initial state and specification
sol = planner(domain, state, spec)
BoundsError: attempt to access 0-element Vector{Vector{Int64}} at index [1]
Stacktrace:
[1] getindex
@ ./essentials.jl:13 [inlined]
[2] build_planning_graph(domain::GenericDomain, state::GenericState, goal::Compound; statics::Vector{Symbol}, relevants::Vector{Symbol})
@ SymbolicPlanners ~/.julia/packages/SymbolicPlanners/IxEs3/src/heuristics/pgraph.jl:112
[3] #build_planning_graph#63
@ ~/.julia/packages/SymbolicPlanners/IxEs3/src/heuristics/pgraph.jl:26 [inlined]
[4] build_planning_graph
@ ~/.julia/packages/SymbolicPlanners/IxEs3/src/heuristics/pgraph.jl:23 [inlined]
[5] precompute!(h::HAdd, domain::GenericDomain, state::GenericState, spec::MinStepsGoal)
@ SymbolicPlanners ~/.julia/packages/SymbolicPlanners/IxEs3/src/heuristics/hsp.jl:79
[6] solve(planner::ForwardPlanner{Nothing}, domain::GenericDomain, state::GenericState, spec::MinStepsGoal)
@ SymbolicPlanners ~/.julia/packages/SymbolicPlanners/IxEs3/src/planners/forward.jl:167
[7] (::ForwardPlanner{Nothing})(domain::GenericDomain, state::GenericState, spec::MinStepsGoal)
@ SymbolicPlanners ~/.julia/packages/SymbolicPlanners/IxEs3/src/planners/planners.jl:18
[8] top-level scope
@ In[41]:1
ztangent commented
Hi! This seems like an issue with the planning graph computation. But could you reformat the post above so that all the code is enclosed within codeboxes (i.e. triple backtick quotes?). Finding it difficult to parse / read with the current formatting. Thanks!
helen-of-troy commented
Thank you for the triple backtick quotes tip.
helen-of-troy commented
I know you said it is fixed, but I reran my test and it worked. Good job.