From 120d9cbcb2f487e7951c266b7ff42c1afaae4512 Mon Sep 17 00:00:00 2001 From: Julian Galvez Serna Date: Tue, 26 Jul 2022 08:19:50 +1000 Subject: [PATCH] upgraded to POMDPTools (#31) * upgraded to POMDPTools * upgraded to POMDPTools --- Project.toml | 12 +++--------- README.md | 2 +- notebooks/Minimal_Example.ipynb | 4 ++-- notebooks/Sanity_Checks.ipynb | 5 +---- src/BasicPOMCP.jl | 5 +---- src/solver.jl | 2 +- src/visualization.jl | 2 +- test/runtests.jl | 6 ++---- 8 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index 05c8dba..d510727 100644 --- a/Project.toml +++ b/Project.toml @@ -1,18 +1,15 @@ name = "BasicPOMCP" uuid = "d721219e-3fc6-5570-a8ef-e5402f47c49e" repo = "https://github.com/JuliaPOMDP/BasicPOMCP.jl" -version = "0.3.6" +version = "0.3.7" [deps] -BeliefUpdaters = "8bb6e9a1-7d73-552c-a44a-e5dc5634aac4" CPUTime = "a9c8d775-2e2e-55fc-8582-045d282d599e" Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" D3Trees = "e3df1716-f71e-5df9-9e2d-98e193103c45" MCTS = "e12ccd36-dcad-5f33-8774-9175229e7b33" POMDPLinter = "f3bd98c0-eb40-45e2-9eb1-f2763262d755" -POMDPModelTools = "08074719-1b2a-587c-a292-00f91cc44415" -POMDPPolicies = "182e52fb-cfd0-5e46-8c26-fd0667c990f4" -POMDPSimulators = "e0d0a172-29c6-5d4e-96d0-f262df5d01fd" +POMDPTools = "7588e00f-9cae-40de-98dc-e0c70c48cdd7" POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" ParticleFilters = "c8b314e2-9260-5cf8-ae76-3be7461ca6d0" @@ -20,15 +17,12 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" [compat] -BeliefUpdaters = "0.2" CPUTime = "1" Colors = "0.9, 0.10, 0.11, 0.12" D3Trees = "0.3" MCTS = "0.4" POMDPLinter = "0.1" -POMDPModelTools = "0.3" -POMDPPolicies = "0.3, 0.4" -POMDPSimulators = "0.3" +POMDPTools = "0.1" POMDPs = "0.9" Parameters = "0.12" ParticleFilters = "0.5" diff --git a/README.md b/README.md index afb833b..d48b177 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ The search tree can be visualized with [D3Trees.jl](https://github.com/sisl/D3Tr using POMDPs using BasicPOMCP using POMDPModels -using POMDPModelTools +using POMDPTools using D3Trees using Random diff --git a/notebooks/Minimal_Example.ipynb b/notebooks/Minimal_Example.ipynb index 72356d3..c07ed5b 100644 --- a/notebooks/Minimal_Example.ipynb +++ b/notebooks/Minimal_Example.ipynb @@ -109,7 +109,7 @@ "outputs": [], "source": [ "using BasicPOMCP\n", - "using POMDPSimulators" + "using POMDPTools" ] }, { @@ -186,7 +186,7 @@ "source": [ "## Reliable Belief Updates\n", "\n", - "By default, if the POMDP does not have an explicit observation model implemented (`POMDPs.observation()` or `POMDPModelTools.obs_weight()`), POMCP will attempt to use the unweighted rejection particle filter defined here: https://github.com/JuliaPOMDP/ParticleFilters.jl/blob/master/src/unweighted.jl. Our `LightDark1D` POMDP has a small enough observation space for that to work, but in most cases, we will need to use a weighted particle filter, which will require definition of the observation distribution." + "By default, if the POMDP does not have an explicit observation model implemented (`POMDPs.observation()` or `POMDPTools.obs_weight()`), POMCP will attempt to use the unweighted rejection particle filter defined here: https://github.com/JuliaPOMDP/ParticleFilters.jl/blob/master/src/unweighted.jl. Our `LightDark1D` POMDP has a small enough observation space for that to work, but in most cases, we will need to use a weighted particle filter, which will require definition of the observation distribution." ] }, { diff --git a/notebooks/Sanity_Checks.ipynb b/notebooks/Sanity_Checks.ipynb index 33b0ffd..8065e18 100644 --- a/notebooks/Sanity_Checks.ipynb +++ b/notebooks/Sanity_Checks.ipynb @@ -20,16 +20,13 @@ "using POMDPModels\n", "using BasicPOMCP\n", "using POMDPs\n", - "using POMDPPolicies\n", "\n", "@everywhere begin\n", " using POMDPModels\n", " using BasicPOMCP\n", " using POMDPs\n", - " using BeliefUpdaters\n", " using Random\n", - " using POMDPSimulators\n", - " using POMDPModelTools\n", + " using POMDPTools\n", "end" ] }, diff --git a/src/BasicPOMCP.jl b/src/BasicPOMCP.jl index 4b6fd0e..9ff7078 100644 --- a/src/BasicPOMCP.jl +++ b/src/BasicPOMCP.jl @@ -12,17 +12,14 @@ Current constraints: using POMDPs using Parameters using ParticleFilters -using BeliefUpdaters -using POMDPPolicies -using POMDPSimulators using CPUTime using Colors using Random using Printf using POMDPLinter: @POMDP_require, @show_requirements +using POMDPTools import POMDPs: action, solve, updater -import POMDPModelTools: action_info, UnderlyingMDP import POMDPLinter using MCTS diff --git a/src/solver.jl b/src/solver.jl index b9b10f2..7bb3600 100644 --- a/src/solver.jl +++ b/src/solver.jl @@ -1,4 +1,4 @@ -function action_info(p::POMCPPlanner, b; tree_in_info=false) +function POMDPTools.action_info(p::POMCPPlanner, b; tree_in_info=false) local a::actiontype(p.problem) info = Dict{Symbol, Any}() try diff --git a/src/visualization.jl b/src/visualization.jl index 3f0ac99..4d45c19 100644 --- a/src/visualization.jl +++ b/src/visualization.jl @@ -5,7 +5,7 @@ function D3Trees.D3Tree(p::POMCPPlanner; title="POMCP Tree", kwargs...) a, info = action_info(planner, b) D3Tree(info[:tree]) - Or, you can get this info from a POMDPSimulators History + Or, you can get this info from a POMDPTools History info = first(ainfo_hist(hist)) D3Tree(info[:tree]) diff --git a/test/runtests.jl b/test/runtests.jl index 7175853..d3c4747 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,9 +5,7 @@ using POMDPModels using NBInclude using D3Trees using Random -using POMDPSimulators -using POMDPModelTools -using POMDPTesting +using POMDPTools using POMDPLinter: @requirements_info, @show_requirements, requirements_info using ParticleFilters: n_particles, particles, particle, weights, weighted_particles, weight_sum, weight @@ -33,7 +31,7 @@ states(p::ConstObsPOMDP) = (true, false) actions(p::ConstObsPOMDP) = (:the_only_action,) observations(p::ConstObsPOMDP) = (true, false) -@testset "POMDPTesting" begin +@testset "POMDPTools" begin pomdp = BabyPOMDP() test_solver(POMCPSolver(), BabyPOMDP()) end;