Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightdark example doesn't work #27

Closed
rejuvyesh opened this issue Aug 10, 2021 · 2 comments
Closed

lightdark example doesn't work #27

rejuvyesh opened this issue Aug 10, 2021 · 2 comments

Comments

@rejuvyesh
Copy link
Member

Adding following to

https://github.com/JuliaPOMDP/QuickPOMDPs.jl/blob/master/examples/lightdark.jl

doesn't work:

using POMDPs
using QMDP

solver = QMDPSolver()
solve(solver, simple_lightdark)

This results into:

CLICK ME

ERROR: MethodError: no method matching (::var"#4#8")(::Int64, ::Int64, ::Int64)
Closest candidates are:
  (::var"#4#8")(::Any, ::Any, ::Any, ::Any) at /mnt/tools/julia/dev/QuickPOMDPs/examples/lightdark.jl:29
Stacktrace:
 [1] reward(::QuickPOMDP{UUID("72444244-debf-4773-8f29-ac07a76d1d95"), Int64, Int64, Float64, NamedTuple{(:stateindex, :isterminal, :states, :discount, :actions, :obstype, :observation, :actionindex, :transition, :reward, :initialstate), Tuple{Dict{Int64, Int64}, var"#1#5", UnitRange{Int64}, Float64, Vector{Int64}, DataType, var"#3#7", Dict{Int64, Int64}, var"#2#6", var"#4#8", POMDPModelTools.Uniform{Set{Int64}}}}}, ::Int64, ::Int64, ::Int64)
   @ QuickPOMDPs /mnt/tools/julia/dev/QuickPOMDPs/src/quick.jl:252
 [2] reward(mdp::UnderlyingMDP{QuickPOMDP{UUID("72444244-debf-4773-8f29-ac07a76d1d95"), Int64, Int64, Float64, NamedTuple{(:stateindex, :isterminal, :states, :discount, :actions, :obstype, :observation, :actionindex, :transition, :reward, :initialstate), Tuple{Dict{Int64, Int64}, var"#1#5", UnitRange{Int64}, Float64, Vector{Int64}, DataType, var"#3#7", Dict{Int64, Int64}, var"#2#6", var"#4#8", POMDPModelTools.Uniform{Set{Int64}}}}}, Int64, Int64}, s::Int64, a::Int64, sp::Int64)
   @ POMDPModelTools ~/.julia/packages/POMDPModelTools/PYObx/src/underlying_mdp.jl:26
 [3] macro expansion
   @ ~/.julia/packages/DiscreteValueIteration/FjeJj/src/vanilla.jl:120 [inlined]
 [4] macro expansion
   @ ./timing.jl:287 [inlined]
 [5] solve(solver::DiscreteValueIteration.ValueIterationSolver, mdp::UnderlyingMDP{QuickPOMDP{UUID("72444244-debf-4773-8f29-ac07a76d1d95"), Int64, Int64, Float64, NamedTuple{(:stateindex, :isterminal, :states, :discount, :actions, :obstype, :observation, :actionindex, :transition, :reward, :initialstate), Tuple{Dict{Int64, Int64}, var"#1#5", UnitRange{Int64}, Float64, Vector{Int64}, DataType, var"#3#7", Dict{Int64, Int64}, var"#2#6", var"#4#8", POMDPModelTools.Uniform{Set{Int64}}}}}, Int64, Int64}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ DiscreteValueIteration ~/.julia/packages/DiscreteValueIteration/FjeJj/src/vanilla.jl:102
 [6] solve
   @ ~/.julia/packages/DiscreteValueIteration/FjeJj/src/vanilla.jl:67 [inlined]
 [7] solve(solver::QMDPSolver{DiscreteValueIteration.ValueIterationSolver}, pomdp::QuickPOMDP{UUID("72444244-debf-4773-8f29-ac07a76d1d95"), Int64, Int64, Float64, NamedTuple{(:stateindex, :isterminal, :states, :discount, :actions, :obstype, :observation, :actionindex, :transition, :reward, :initialstate), Tuple{Dict{Int64, Int64}, var"#1#5", UnitRange{Int64}, Float64, Vector{Int64}, DataType, var"#3#7", Dict{Int64, Int64}, var"#2#6", var"#4#8", POMDPModelTools.Uniform{Set{Int64}}}}})
   @ QMDP ~/.julia/packages/QMDP/N6dCz/src/vanilla.jl:34
 [8] top-level scope
   @ REPL[7]:1

@rejuvyesh
Copy link
Member Author

 reward = function (s, a, sp)
        if a == 0
            return s == 0 ? 100 : -100
        else
            return -1.0
        end
    end,

fixes the error.

@zsunberg
Copy link
Member

Fixed with a56b986

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants