From 509d0cd7a7ccd784e46fdf8bacd678bb3f26b563 Mon Sep 17 00:00:00 2001 From: Logan Mondal Bhamidipaty <76822456+FlyingWorkshop@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:13:10 -0700 Subject: [PATCH] changed default compressor --- README.md | 30 ++++++++++++++++-------------- src/solver.jl | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 706c2cc..fcb8aa2 100644 --- a/README.md +++ b/README.md @@ -14,17 +14,15 @@ add CompressedBeliefMDPs CompressedBeliefMDPs.jl is compatible with the [POMDPs.jl](https://juliapomdp.github.io/POMDPs.jl/latest/) ecosystem. ```julia +using POMDPs, POMDPModels using CompressedBeliefMDPs -using POMDPs -using POMDPModels -using POMDPTools - -pomdp = TMaze(200, 0.99) -sampler = DiscreteRandomSampler(pomdp) -compressor = PCACompressor(2) -solver = CompressedSolver(pomdp, sampler, compressor) -policy = solve(solver, pomdp) +pomdp = BabyPOMDP() +solver = CompressedBeliefSolver(pomdp) +policy = POMDPs.solve(solver, pomdp) +s = initialstate(pomdp) +v = value(policy, s) +a = action(policy, s) ``` The solver finds an _approximate_ policy for the POMDP. @@ -35,12 +33,16 @@ a = action(policy, s) ``` # Sampling -Compression is handled by the `Sampler` abstract type. +There are two ways to collect belief samples: belief expansion or policy rollouts. + +## Belief Expansion + +CompressedBeliefMDPs.jl implements a fast version of exploratory belief expansion (Algorithm 21.13 from [Algorithms for Decision Making](https://algorithmsbook.com/)) that uses [$k$-d trees](https://en.wikipedia.org/wiki/K-d_tree) from [NearestNeighbors.jl](https://github.com/KristofferC/NearestNeighbors.jl). Belief expansion is supported for POMDPs with finite state, action, and observation spaces. + +## Policy Rollouts -# Compression -Compression is handled by the `Compressor` abstract type. -## [MultivariateStats.jl](https://juliapackages.com/p/multivariatestats) Wrappers +# Compressors -As a convenience, we provide several wrappers for compression schemes from MultivariateStats.jl. \ No newline at end of file +As a convenience, we provide several wrappers for compression schemes from [MultivariateStats.jl](https://juliastats.org/MultivariateStats.jl/stable/) and [ManifoldLearning.jl](https://wildart.github.io/ManifoldLearning.jl/stable/). \ No newline at end of file diff --git a/src/solver.jl b/src/solver.jl index 9e3be1f..4b34d37 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -103,7 +103,7 @@ function CompressedBeliefSolver( # sampling arguments explorer::Union{Policy, ExplorationPolicy}=RandomPolicy(pomdp), # explorer policy; only used if expansion is false updater::Updater=DiscreteUpdater(pomdp), # only works for discrete S - compressor::Compressor=PCACompressor(1), + compressor::Compressor=PCACompressor(2), expansion=true, # only works for discrete S, A, O n::Integer=5, # if expansion, then n is the number of times we expand; otherwise, n is max number of belief samples metric::NearestNeighbors.MinkowskiMetric=Euclidean(),