Skip to content

Commit

Permalink
added history and currentobs to future
Browse files Browse the repository at this point in the history
  • Loading branch information
zsunberg committed Sep 13, 2019
1 parent 0dcb1cc commit f73441e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/POMDPs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export
nodenames,
DDNStructure,
outputnames,
history,
currentobs,

# Deprecated
state_index,
Expand Down
21 changes: 21 additions & 0 deletions src/future.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,24 @@ end
DDNStructure(::Type{M}) where M <: MDP = DDNStructureV7{(:s,:a,:sp,:r)}()
DDNStructure(::Type{M}) where M <: POMDP = DDNStructureV7{(:s,:a,:sp,:o,:r)}()
DDNStructure(m::Union{MDP,POMDP}) = DDNStructure(typeof(m))

"""
history(b)
Return the action-observation history associated with belief `b`.
The history should be an `AbstractVector` full of `NamedTuples` with keys `:a` and `:o`, i.e. `history(b)[end][:a]` should be the last action taken leading up to `b`, and `history(b)[end][:o]` should be the last observation received.
It is acceptable to return only part of the history if that is all that is available, but it should always end with the current observation. For example, it would be acceptable to return a structure containing only the last three observations in a length 3 `Vector{NamedTuple{(:o,),Tuple{O}}`.
"""
function history end

"""
currentobs(b)
Return the latest observation associated with belief `b`.
If a solver or updater implements `history(b)` for a belief type, `currentobs` has a default implementation.
"""
currentobs(b) = history(b)[end].o
@impl_dep currentobs(::B) where B history(::B)

0 comments on commit f73441e

Please sign in to comment.