Skip to content

Commit

Permalink
fix names
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximeBouton committed Aug 9, 2019
1 parent fbac163 commit 15b0084
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions docs/src/model_transformations.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ SparseTabularPOMDP
transition_matrix
reward_vector
observation_matrix
transition_matrices
reward_matrix
observation_matrices
```

## Fully Observable POMDP
Expand Down
5 changes: 4 additions & 1 deletion src/POMDPModelTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ export
SparseTabularPOMDP,
transition_matrix,
reward_vector,
observation_matrix
observation_matrix,
transition_matrices,
reward_matrix,
observation_matrices

include("sparse_tabular.jl")

Expand Down
8 changes: 4 additions & 4 deletions src/sparse_tabular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ It returns a sparse matrix containing the transition probabilities when taking a
transition_matrix(p::SparseTabularProblem, a) = p.T[a]

"""
transition_matrix(p::SparseTabularProblem)
transition_matrices(p::SparseTabularProblem)
Accessor function for the transition model of a sparse tabular problem.
It returns a list of sparse matrices for each action of the problem.
"""
transition_matrix(p::SparseTabularProblem) = p.T
transition_matrices(p::SparseTabularProblem) = p.T

"""
reward_vector(p::SparseTabularProblem, a)
Expand Down Expand Up @@ -310,8 +310,8 @@ It returns a sparse matrix containing the observation probabilities when having
observation_matrix(p::SparseTabularPOMDP, a::Int64) = p.O[a]

"""
observation_matrix(p::SparseTabularPOMDP)
observation_matrices(p::SparseTabularPOMDP)
Accessor function for the observation model of a sparse tabular POMDP.
It returns a list of sparse matrices for each action of the problem.
"""
observation_matrix(p::SparseTabularPOMDP) = p.O
observation_matrices(p::SparseTabularPOMDP) = p.O
4 changes: 2 additions & 2 deletions test/test_tabular.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ spomdp3 = SparseTabularPOMDP(spomdp, transition = [sparse(1:n_states(mdp), 1:n_s
spomdp3 = SparseTabularPOMDP(spomdp, discount = 0.5)
@test spomdp3.discount != spomdp.discount
@test size(observation_matrix(spomdp, 1)) == (n_states(spomdp), n_observations(spomdp))
@test observation_matrix(spomdp) == spomdp2.O
@test transition_matrix(spomdp) == spomdp2.T
@test observation_matrices(spomdp) == spomdp2.O
@test transition_matrices(spomdp) == spomdp2.T
@test reward_matrix(spomdp) == spomdp2.R

## Tests
Expand Down

0 comments on commit 15b0084

Please sign in to comment.