diff --git a/src/planner.jl b/src/planner.jl index c911c8d..964e94f 100644 --- a/src/planner.jl +++ b/src/planner.jl @@ -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) diff --git a/src/pomdps_glue.jl b/src/pomdps_glue.jl index 8008e14..6784c80 100644 --- a/src/pomdps_glue.jl +++ b/src/pomdps_glue.jl @@ -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) diff --git a/test/runtests.jl b/test/runtests.jl index 1ea4f62..8e79801 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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) @@ -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