JuliaPOMDP / SARSOP.jl

Julia package that wraps the SARSOP software for solving POMDPs/MDPs
Other
14 stars 7 forks source link

Help #49

Closed Etwari3 closed 3 years ago

Etwari3 commented 3 years ago

When I try to run SARSOP, I get the following error message:

Generating a pomdpx file: model.pomdpx MethodError: no method matching isless(::Int64, ::Symbol) Closest candidates are: isless(::Missing, ::Any) at missing.jl:87 isless(::Symbol, ::Symbol) at strings/basic.jl:341 isless(::Real, ::AbstractFloat) at operators.jl:166 ...

any suggestion on how to fix it? I am trying this model for the first time. so please forgive my ignorance.

zsunberg commented 3 years ago

Hi @Etwari3 , It looks like you are trying to compare an integer to a symbol. If you post the stack trace, we can probably give some more ideas of what the problem might be.

zsunberg commented 3 years ago

you might also be able to find more help in the POMDPs.jl discussions: https://github.com/JuliaPOMDP/POMDPs.jl/discussions

Etwari3 commented 3 years ago

Thank you. Here is the complete error message report.

Generating a pomdpx file: model.pomdpx MethodError: no method matching isless(::Int64, ::Symbol) Closest candidates are: isless(::Missing, ::Any) at missing.jl:87 isless(::Symbol, ::Symbol) at strings/basic.jl:341 isless(::Real, ::AbstractFloat) at operators.jl:166 ...

Stacktrace: [1] <(::Int64, ::Symbol) at .\operators.jl:277 [2] >(::Symbol, ::Int64) at .\operators.jl:303 [3] ordered_vector(::Type{T} where T, ::POMDPModelTools.var"#5#6"{CancerPOMDP}, ::Array{Symbol,1}, ::String, ::String) at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:36 [4] ordered_vector at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:31 [inlined] [5] ordered_observations(::CancerPOMDP) at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:28 [6] obs_xml(::CancerPOMDP, ::POMDPXFiles.POMDPXFile, ::IOStream) at C:\Users\ezrat.julia\packages\POMDPXFiles\f6sNq\src\writer.jl:278 [7] write(::CancerPOMDP, ::POMDPXFiles.POMDPXFile) at C:\Users\ezrat.julia\packages\POMDPXFiles\f6sNq\src\writer.jl:103 [8] POMDPFile(::CancerPOMDP, ::String; verbose::Bool) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\file.jl:24 [9] solve(::SARSOPSolver, ::CancerPOMDP; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\solver.jl:65 [10] solve(::SARSOPSolver, ::CancerPOMDP) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\solver.jl:62

[12] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

zsunberg commented 3 years ago

looks like your obsindex function returns a Symbol. Any way that could be happening? Posting your obsindex function might help.

On Tue, Aug 24, 2021 at 2:44 PM Etwari3 @.***> wrote:

Thank you. Here is the complete error message report.

Generating a pomdpx file: model.pomdpx MethodError: no method matching isless(::Int64, ::Symbol) Closest candidates are: isless(::Missing, ::Any) at missing.jl:87 isless(::Symbol, ::Symbol) at strings/basic.jl:341 isless(::Real, ::AbstractFloat) at operators.jl:166 ...

Stacktrace: [1] <(::Int64, ::Symbol) at .\operators.jl:277 [2] >(::Symbol, ::Int64) at .\operators.jl:303 [3] ordered_vector(::Type{T} where T, ::POMDPModelTools.var"#5 https://github.com/JuliaPOMDP/SARSOP.jl/pull/5#6"{CancerPOMDP}, ::Array{Symbol,1}, ::String, ::String) at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:36 [4] ordered_vector at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:31 [inlined] [5] ordered_observations(::CancerPOMDP) at C:\Users\ezrat.julia\packages\POMDPModelTools\PYObx\src\ordered_spaces.jl:28 [6] obs_xml(::CancerPOMDP, ::POMDPXFiles.POMDPXFile, ::IOStream) at C:\Users\ezrat.julia\packages\POMDPXFiles\f6sNq\src\writer.jl:278 [7] write(::CancerPOMDP, ::POMDPXFiles.POMDPXFile) at C:\Users\ezrat.julia\packages\POMDPXFiles\f6sNq\src\writer.jl:103 [8] POMDPFile(::CancerPOMDP, ::String; verbose::Bool) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\file.jl:24 [9] solve(::SARSOPSolver, ::CancerPOMDP; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\solver.jl:65 [10] solve(::SARSOPSolver, ::CancerPOMDP) at C:\Users\ezrat.julia\packages\SARSOP\VcdgE\src\solver.jl:62

[12] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaPOMDP/SARSOP.jl/issues/49#issuecomment-904960562, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABALI234P2OM56PW7VS6SXLT6P77JANCNFSM5CU45S7Q .

Etwari3 commented 3 years ago

Here is the function for the observation matrix

function returning observation space

POMDPs.observations(::CancerPOMDP) = [:neg, :pos, :na] POMDPs.obsindex(pomdp::CancerPOMDP, o::Symbol) = o

function POMDPs.observation(pomdp::CancerPOMDP, a::Symbol, s::Bool) if a == :do_nothing if s return SparseCat([:neg, :pos, :na], [0.0,0.0,1.0]) else return SparseCat([:neg, :pos, :na], [0.0, 0.0, 1.0]) end else if s return SparseCat([:neg, :pos, :na], [0.8, 0.2, 0.0]) else return SparseCat([:neg, :pos, :na], [0.1, 0.9, 0.0]) end end end

Etwari3 commented 3 years ago

Thanks.