Skip to content

Commit

Permalink
Merge pull request #166 from JuliaPOMDP/less_specific
Browse files Browse the repository at this point in the history
Less specific

osx tests did not pass, but I can't wait around for that
  • Loading branch information
zsunberg authored Oct 20, 2017
2 parents 41440b8 + b0330f1 commit 2b43556
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/pomdp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ function observation end
Return the observation distribution for the a-s' tuple (action and next state)
"""
observation{S,A,O}(problem::POMDP{S,A,O}, a::A, sp::S) = observation(problem, sp)
observation(problem::POMDP, a, sp) = observation(problem, sp)
@impl_dep {P<:POMDP,S,A} observation(::P,::A,::S) observation(::P,::S)

"""
observation{S,A,O}(problem::POMDP{S,A,O}, state::S, action::A, statep::S)
Return the observation distribution for the s-a-s' tuple (state, action, and next state)
"""
observation{S,A,O}(problem::POMDP{S,A,O}, s::S, a::A, sp::S) = observation(problem, a, sp)
observation(problem::POMDP, s, a, sp) = observation(problem, a, sp)
@impl_dep {P<:POMDP,S,A} observation(::P,::S,::A,::S) observation(::P,::A,::S)

"""
Expand All @@ -93,23 +93,23 @@ function reward end
Return the immediate reward for the s-a-s' triple
"""
reward(problem, s, a, sp) = reward(problem, s, a)
reward(problem::Union{POMDP,MDP}, s, a, sp) = reward(problem, s, a)
@impl_dep {P<:Union{POMDP,MDP},S,A} reward(::P,::S,::A,::S) reward(::P,::S,::A)

"""
isterminal_obs{S,A,O}(problem::POMDP{S,A,O}, observation::O)
Check if an observation is terminal.
"""
isterminal_obs{S,A,O}(problem::POMDP{S,A,O}, observation::O) = false
isterminal_obs(problem::POMDP, observation) = false

"""
isterminal{S,A,O}(problem::POMDP{S,A,O}, state::S)
isterminal{S,A}(problem::MDP{S,A}, state::S)
Check if state s is terminal
"""
isterminal{S,A}(problem::Union{POMDP{S,A},MDP{S,A}}, state::S) = false
isterminal(problem::Union{POMDP,MDP}, state) = false

"""
state_index{S,A,O}(problem::POMDP{S,A,O}, s::S)
Expand Down Expand Up @@ -182,18 +182,3 @@ function Base.convert(T::Type, x::X, problem::Union{MDP,POMDP}) where X
Base.depwarn("POMDPs.convert is deprecated. Please use convert_s, convert_a, or convert_o.", :convert)
return convert_s(T, x, problem)
end
#=
"""
convert{S}(::Type{V}, s::S, problem::Union{MDP,POMDP}) where V <: AbstractArray
convert{S}(::Type{S}, vec::V, problem::Union{MDP,POMDP}) where V <: AbstractArray
Convert a state or observaton to vectorized form of floats or convert
an array of floats back to a problem specific state or observation.
"""
Base.convert
Base.convert(T::Type{A1}, s::A2, problem::Union{MDP, POMDP}) where {A1<:AbstractArray, A2<:AbstractArray} = convert(T, s)
Base.convert(::Type{A}, s::Number, problem::Union{MDP,POMDP}) where A<:AbstractArray{F} where F<:Number = F[s]
Base.convert(::Type{N}, v::AbstractArray{F}, problem::Union{MDP, POMDP}) where {N<:Number, F<:Number} = convert(N, first(v))
=#

0 comments on commit 2b43556

Please sign in to comment.