Skip to content

Commit 5d59969

Browse files
Tabular approx tests
1 parent 28d3ce5 commit 5d59969

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/ReinforcementLearningCore/test/policies/approximators.jl renamed to src/ReinforcementLearningCore/test/policies/learners/approximators.jl

File renamed without changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include("approximator.jl")
2+
include("tabular_approximator.jl")
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
using Test
3+
using ReinforcementLearningCore
4+
using Flux
5+
6+
@testset "Constructors" begin
7+
@test TabularApproximator(fill(1, 10, 10), fill(1, 10)) isa TabularApproximator
8+
@test TabularVApproximator(n_state = 10) isa
9+
TabularApproximator{Vector{Float64},InvDecay}
10+
@test TabularQApproximator(n_state = 10, n_action = 10) isa
11+
TabularApproximator{Matrix{Float64},InvDecay}
12+
end
13+
14+
@testset "RLCore.forward" begin
15+
v_approx = TabularVApproximator(n_state = 10)
16+
@test RLCore.forward(v_approx, 1) == 0.0
17+
18+
q_approx = TabularQApproximator(n_state = 5, n_action = 10)
19+
@test RLCore.forward(q_approx, 1) == zeros(Float64, 10)
20+
@test RLCore.forward(q_approx, 1, 5) == 0.0
21+
end
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
include("agent.jl")
22
include("multi_agent.jl")
3-
include("approximators.jl")
3+
include("learners/learners.jl")
4+

0 commit comments

Comments
 (0)