Skip to content

Commit

Permalink
finished adding tree_in_info arg and action_info
Browse files Browse the repository at this point in the history
  • Loading branch information
zsunberg committed Dec 18, 2018
1 parent 4de6b3d commit 13a3be1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BasicPOMCP = "d721219e-3fc6-5570-a8ef-e5402f47c49e"
BeliefUpdaters = "8bb6e9a1-7d73-552c-a44a-e5dc5634aac4"
CPUTime = "a9c8d775-2e2e-55fc-8582-045d282d599e"
D3Trees = "e3df1716-f71e-5df9-9e2d-98e193103c45"
POMDPModelTools = "08074719-1b2a-587c-a292-00f91cc44415"
POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
ParticleFilters = "c8b314e2-9260-5cf8-ae76-3be7461ca6d0"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ Bounds need not be calculated independently; a single object or function that re
[D3Trees.jl](https://github.com/sisl/D3Trees.jl) can be used to visualize the search tree, for example

```julia
using POMDPs, POMDPModels, D3Trees, ARDESPOT
using POMDPs, POMDPModels, POMDPModelTools, D3Trees, ARDESPOT

pomdp = TigerPOMDP()

solver = DESPOTSolver(bounds=(-20.0, 0.0))
solver = DESPOTSolver(bounds=(-20.0, 0.0), tree_in_info=true)
planner = solve(solver, pomdp)
b0 = initialstate_distribution(pomdp)

tree = ARDESPOT.build_despot(planner, b0)
inchrome(D3Tree(tree, init_expand=5))
a, info = action_info(planner, b0)
inchrome(D3Tree(info[:tree], init_expand=5))
```
will create an interactive tree that looks like this:

Expand Down
1 change: 1 addition & 0 deletions src/ARDESPOT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using ParticleFilters
using D3Trees
using Random
using Printf
using POMDPModelTools

using BasicPOMCP # for ExceptionRethrow and NoDecision
import BasicPOMCP.default_action
Expand Down
2 changes: 1 addition & 1 deletion src/pomdps_glue.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
POMDPs.solve(sol::DESPOTSolver, p::POMDP) = DESPOTPlanner(sol, p)

function POMDPs.action_info(p::DESPOTPlanner, b)
function POMDPModelTools.action_info(p::DESPOTPlanner, b)
info = Dict{Symbol, Any}()
try
Random.seed!(p.rs, rand(p.rng, UInt32))
Expand Down
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using POMDPs
using POMDPModels
using POMDPSimulators
using Random
using POMDPModelTools

include("memorizing_rng.jl")

Expand Down Expand Up @@ -71,7 +72,8 @@ rng = MersenneTwister(4)
solver = DESPOTSolver(epsilon_0=0.1,
bounds=bounds,
rng=rng,
random_source=MemorizingSource(500, 90, rng)
random_source=MemorizingSource(500, 90, rng),
tree_in_info=true
)
p = solve(solver, pomdp)
a = action(p, initialstate_distribution(pomdp))
Expand All @@ -80,6 +82,8 @@ include("random_2.jl")

# visualization
show(stdout, MIME("text/plain"), D)
a, info = action_info(p, initialstate_distribution(pomdp))
show(stdout, MIME("text/plain"), info[:tree])

# from README:
using POMDPs, POMDPModels, POMDPSimulators, ARDESPOT
Expand Down

0 comments on commit 13a3be1

Please sign in to comment.