Skip to content

Commit bb74043

Browse files
committed
simplify
1 parent 8f035d6 commit bb74043

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/learner/mdplearner.jl

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
2-
struct MDPLearner
3-
γ::Float64
4-
policy::Array{Int64, 1}
5-
values::Array{Float64, 1}
6-
mdp::MDP
2+
@with_kw struct MDPLearner
3+
mdp::MDP = MDP()
4+
γ::Float64 = .9
5+
policy::Array{Int64, 1} = ones(Int64, mdp.ns)
6+
values::Array{Float64, 1} = zeros(mdp.ns)
77
88
Used to solve `mdp` with discount factor `γ`.
99
"""
@@ -15,10 +15,6 @@ Used to solve `mdp` with discount factor `γ`.
1515
end
1616
export MDPLearner
1717

18-
function MDPLearner(mdp, γ::Float64)
19-
return MDPLearner= γ, mdp = mdp)
20-
end
21-
2218
@inline function selectaction(learner::MDPLearner,
2319
policy::AbstractEpsilonGreedyPolicy, state)
2420
if rand() < policy.ϵ

0 commit comments

Comments
 (0)