From 581c20e9107580c7501adc203a83b9e916fd187f Mon Sep 17 00:00:00 2001 From: Logan Mondal Bhamidipaty <76822456+FlyingWorkshop@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:03:08 -0700 Subject: [PATCH] added more tests to CI matrix --- .github/workflows/CI.yml | 2 ++ docs/src/index.md | 3 +++ src/cbmdp.jl | 2 +- test/compressor_tests.jl | 6 +++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b6e5bb7..00cba9d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -26,6 +26,8 @@ jobs: - '1.10' os: - ubuntu-latest + - macOS-latest + - windows-latest arch: - x64 steps: diff --git a/docs/src/index.md b/docs/src/index.md index 6583f05..9973f05 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -19,6 +19,9 @@ pkg> add CompressedBeliefMDPs Using belief compression is easy. Simplify pick a `Sampler`, `Compressor`, and a base `Policy` and then use the standard POMDPs.jl interface. ```julia +using POMDPs, POMDPTools, POMDPModels +using CompressedBeliefMDPs + pomdp = BabyPOMDP() compressor = PCACompressor(1) updater = DiscreteUpdater(pomdp) diff --git a/src/cbmdp.jl b/src/cbmdp.jl index 02695d1..0d598b0 100644 --- a/src/cbmdp.jl +++ b/src/cbmdp.jl @@ -85,7 +85,7 @@ POMDPs.discount(m::CompressedBeliefMDP) = discount(m.bmdp) POMDPs.convert_s(t::Type, s, m::CompressedBeliefMDP) = convert_s(t, s, m.bmdp.pomdp) POMDPs.convert_s(t::Type{<:AbstractArray}, s::AbstractArray, m::CompressedBeliefMDP) = convert_s(t, s, m.bmdp.pomdp) # NOTE: this second implementation is b/c to get around a requirement from POMDPLinter -# TODO: maybe exclude include sparsecat +# TODO: maybe exclude include sparsecat; e.g., for sparsecat do [pdf(s, x) for x in support(s)] ExplicitDistribution = Union{SparseCat, BoolDistribution, Deterministic, Uniform} # distributions w/ explicit PDFs from POMDPs.jl (https://juliapomdp.github.io/POMDPs.jl/latest/POMDPTools/distributions/#Implemented-Distributions) POMDPs.convert_s(::Type{<:AbstractArray}, s::ExplicitDistribution, m::POMDP) = [pdf(s, x) for x in states(m)] POMDPs.convert_s(::Type{V}, s::DiscreteBelief, p::POMDP) where V<:AbstractArray = s.b diff --git a/test/compressor_tests.jl b/test/compressor_tests.jl index 7979afb..741f5e9 100644 --- a/test/compressor_tests.jl +++ b/test/compressor_tests.jl @@ -25,7 +25,7 @@ FLUX_COMPRESSORS = ( @testset "Compressor Tests" begin pomdp = BabyPOMDP() - sampler = PolicySampler(pomdp; n=50) + sampler = BeliefExpansionSampler(pomdp; n=5) @testset "MultivariateStats Compressors" begin @testset "$C" for C in MVS_COMPRESSORS @test_nowarn test_compressor(pomdp, sampler, C(1)) @@ -34,8 +34,8 @@ FLUX_COMPRESSORS = ( end @testset "ManifoldLearning Compressors" begin @testset "$C" for C in MANIFOLD_COMPRESSORS - @test_nowarn test_compressor(pomdp, sampler, C(1; k=15)) - @test_nowarn test_compressor(pomdp, sampler, C(2; k=15)) + @test_nowarn test_compressor(pomdp, sampler, C(1; k=5)) + @test_nowarn test_compressor(pomdp, sampler, C(2; k=5)) end end @testset "Flux Compressors" begin