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

ParticleFilters fails on discrete POMDPs #7

Closed
FlyingWorkshop opened this issue Apr 6, 2024 · 1 comment
Closed

ParticleFilters fails on discrete POMDPs #7

FlyingWorkshop opened this issue Apr 6, 2024 · 1 comment
Assignees

Comments

@FlyingWorkshop
Copy link
Member

Steps to recreate:

using POMDPs, POMDPModels, POMDPTools
using ParticleFilters

using CompressedBeliefMDPs

using Random
Random.seed!(1)

pomdp = BabyPOMDP()
updater = SIRParticleFilter(pomdp, 1000)
solver = CompressedBeliefSolver(pomdp; updater=updater)
policy = solve(solver, pomdp)

Output:

julia> include("arena/filter_test.jl")
ERROR: LoadError: DimensionMismatch: dimensions must match: a has dims (Base.OneTo(1000),), b has dims (Base.OneTo(2),), mismatch at 1
Stacktrace:
  [1] promote_shape
    @ ./indices.jl:178 [inlined]
  [2] promote_shape
    @ ./indices.jl:169 [inlined]
  [3] -(A::Vector{Float64}, B::Vector{Float64})
    @ Base ./arraymath.jl:7
  [4] centralize(x::Vector{Float64}, m::Vector{Float64})
    @ MultivariateStats ~/.julia/packages/MultivariateStats/zLpz8/src/common.jl:15
  [5] predict(M::MultivariateStats.PCA{Float64}, x::Vector{Float64})
    @ MultivariateStats ~/.julia/packages/MultivariateStats/zLpz8/src/pca.jl:122
  [6] (::MVSCompressor{MultivariateStats.PCA})(beliefs::Vector{Float64})
    @ CompressedBeliefMDPs ~/VSCodeProjects/BeliefCompression/CompressedBeliefMDPs/src/compressors/mvs_compressors.jl:21
  [7] CompressedBeliefMDP(pomdp::BabyPOMDP, updater::BasicParticleFilter{…}, compressor::MVSCompressor{…})
    @ CompressedBeliefMDPs ~/VSCodeProjects/BeliefCompression/CompressedBeliefMDPs/src/cbmdp.jl:45
  [8] _make_compressed_belief_MDP(pomdp::BabyPOMDP, sampler::BeliefExpansionSampler, updater::BasicParticleFilter{…}, compressor::MVSCompressor{…})
    @ CompressedBeliefMDPs ~/VSCodeProjects/BeliefCompression/CompressedBeliefMDPs/src/solver.jl:96
  [9] CompressedBeliefSolver(pomdp::BabyPOMDP; updater::BasicParticleFilter{…}, sampler::BeliefExpansionSampler, compressor::MVSCompressor{…}, interp::Nothing, k::Int64, verbose::Bool, max_iterations::Int64, n_generative_samples::Int64, belres::Float64)
    @ CompressedBeliefMDPs ~/VSCodeProjects/BeliefCompression/CompressedBeliefMDPs/src/solver.jl:127
 [10] top-level scope
    @ ~/VSCodeProjects/BeliefCompression/arena/filter_test.jl:12
 [11] include(fname::String)
    @ Base.MainInclude ./client.jl:489
 [12] top-level scope
    @ REPL[1]:1
 [13] top-level scope
    @ ~/.julia/packages/Infiltrator/TNlCu/src/Infiltrator.jl:798
in expression starting at /Users/logan/VSCodeProjects/BeliefCompression/arena/filter_test.jl:12
Some type information was truncated. Use `show(err)` to see complete types.
@FlyingWorkshop FlyingWorkshop self-assigned this Apr 6, 2024
@FlyingWorkshop
Copy link
Member Author

You have to update the sampler too:

using POMDPs, POMDPModels, POMDPTools
using ParticleFilters

using CompressedBeliefMDPs


using Random
Random.seed!(1)

pomdp = BabyPOMDP()
updater = SIRParticleFilter(pomdp, 1000)
solver = CompressedBeliefSolver(
    pomdp; 
    updater=updater, 
    sampler=PolicySampler(pomdp; updater=updater)
)
policy = solve(solver, pomdp)

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

1 participant