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

added search time into action info #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/planner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function build_despot(p::DESPOTPlanner, b_0)
trial += 1
end

return D
return D, CPUtime_us()-start
end

function explore!(D::DESPOT, b::Int, p::DESPOTPlanner)
Expand Down
3 changes: 2 additions & 1 deletion src/pomdps_glue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ function POMDPTools.action_info(p::DESPOTPlanner, b)
try
Random.seed!(p.rs, rand(p.rng, UInt32))

D = build_despot(p, b)
D, search_time = build_despot(p, b)

if p.sol.tree_in_info
info[:tree] = D
end
info[:search_time_us] = search_time

check_consistency(p.rs)

Expand Down
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ solver = DESPOTSolver(epsilon_0=0.1,
p = solve(solver, pomdp)

b0 = initialstate(pomdp)
D = @inferred ARDESPOT.build_despot(p, b0)
D, search_time = @inferred ARDESPOT.build_despot(p, b0)
@test search_time !== NaN
@inferred ARDESPOT.explore!(D, 1, p)
@inferred ARDESPOT.expand!(D, length(D.children), p)
@inferred ARDESPOT.prune!(D, 1, p)
Expand Down Expand Up @@ -123,6 +124,9 @@ show(stdout, MIME("text/plain"), D)
a, info = action_info(p, initialstate(pomdp))
show(stdout, MIME("text/plain"), info[:tree])

# check if search_time exists in info
@test info[:search_time_us] !== NaN

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