-
Notifications
You must be signed in to change notification settings - Fork 4
/
interface.jl
73 lines (54 loc) · 2.08 KB
/
interface.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
HorizonLength(::Type{<:Union{MDP,POMDP})
HorizonLength(::Union{MDP,POMDP})
Check whether MDP is Finite or Infinite Horizon and return corresponding struct (FiniteHorizon or InfiniteHorizon).
"""
abstract type HorizonLength end
"If HorizonLength(m::Union{MDP,POMDP}) == FiniteHorizon(), horizon(m) should be implemented and return an integer"
struct FiniteHorizon <: HorizonLength end
"HorizonLength(m::Union{MDP,POMDP}) == InfiniteHorizon() indicates that horizon(m) should not be called."
struct InfiniteHorizon <: HorizonLength end
HorizonLength(m::Union{MDP,POMDP}) = HorizonLength(typeof(m))
HorizonLength(::Type{<:Union{MDP,POMDP}}) = InfiniteHorizon()
"""
Return the number of *steps* that will be taken in the (PO)MDP, given it is Finite Horizon.
A simulation of a (PO)MDP with `horizon(m) == d` should contain *d+1* states and *d* actions and rewards.
"""
function horizon end
"""
stage(m::Union{MDP,POMDP}, ss)::Int
stage(m::Union{MDP,POMDP}, o)::Int
stage(d)::Int
Considering a variable or distribution containing its stage assignment, return the number of its stage.
"""
function stage end
"""
stage_states(m::Union{MDP,POMDP}, stage::Int)
Create (PO)MDP's states for given stage.
"""
function stage_states end
"""
stage_stateindex(m::Union{MDP,POMDP}, ss}::Int
Compute the index of the given state in the corresponding stage.
"""
function stage_stateindex end
"""
ordered_stage_states(w::FHWrapper, stage::Int)
Return an AbstractVector of states from given stage ordered according to stage_stateindex(mdp, s).
"""
function ordered_stage_states end
"""
stage_observations(m::Union{MDP,POMDP}, stage::Int)
Create (PO)MDP's observations for given stage.
"""
function stage_observations end
"""
stage_obsindex(m::Union{MDP,POMDP}, o::stage::Int)
Compute the index of the given observation in the corresponding stage.
"""
function stage_obsindex end
"""
ordered_stage_observations(w::FHWrapper, stage::Int)
Return an AbstractVector of observations from given stage ordered according to stage_obsindex(w,o).
"""
function ordered_stage_observations end