Skip to content

Commit

Permalink
Drop num_actions from DiscreteDP (#207)
Browse files Browse the repository at this point in the history
* Drop `num_actions` from DiscreteDP
solves #103

* Drop `num_actions` from DiscreteDP but keep variables name
solves #103

* doc formatting imporved
  • Loading branch information
a-parida12 authored and sglyon committed Jun 23, 2018
1 parent 425b7f7 commit 785c71b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/markov/ddp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ mutable struct DiscreteDP{T<:Real,NQ,NR,Tbeta<:Real,Tind,TQ<:AbstractArray{T,NQ}
if NR != 2
msg = "R must be 2-dimensional without s-a formulation"
throw(ArgumentError(msg))
end
end
(beta < 0 || beta >= 1) && throw(ArgumentError("beta must be [0, 1)"))

# verify input integrity 2
num_states, num_actions = size(R)
num_states, num_actions = size(R)
if size(Q) != (num_states, num_actions, num_states)
throw(ArgumentError("shapes of R and Q must be (n,m) and (n,m,n)"))
end

# check feasibility
R_max = s_wise_max(R)
if any(R_max .== -Inf)
Expand Down Expand Up @@ -215,7 +215,7 @@ const DDPsa{T,Tbeta,Tind,TQ} = DiscreteDP{T,2,1,Tbeta,Tind,TQ}

num_states(ddp::DDP) = size(ddp.R, 1)
num_states(ddp::DDPsa) = size(ddp.Q, 2)
num_actions(ddp::DiscreteDP) = size(ddp.R, 2)


abstract type DDPAlgorithm end
"""
Expand Down

0 comments on commit 785c71b

Please sign in to comment.