Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/policies/agents/trajectories/trajectory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ CircularArrayPSARTTrajectory(; capacity, kwargs...) = PrioritizedTrajectory(
function Base.length(
t::Union{
CircularArraySARTTrajectory,
CircularArraySLARTTrajectory,
CircularVectorSARTSATrajectory,
ElasticSARTTrajectory,
},
Expand Down
2 changes: 1 addition & 1 deletion src/policies/agents/trajectories/trajectory_extension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ end

function fetch!(
sampler::NStepBatchSampler{traces},
traj::CircularArraySARTTrajectory,
traj::Union{CircularArraySARTTrajectory, CircularArraySLARTTrajectory},
inds::Vector{Int},
) where {traces}
γ, n, bz, sz = sampler.γ, sampler.n, sampler.batch_size, sampler.stack_size
Expand Down
8 changes: 7 additions & 1 deletion test/components/trajectories.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@
@testset "CircularArraySLARTTrajectory" begin
t = CircularArraySLARTTrajectory(
capacity = 3,
state = Matrix{Float32} => (2,2),
state = Vector{Int} => (4,),
legal_actions_mask = Vector{Bool} => (4, ),
)

# test instance type is same as type
@test isa(t, CircularArraySLARTTrajectory)

@test length(t) == 0
push!(t; state = ones(Int, 4), action = 1, legal_actions_mask = trues(4))
@test length(t) == 0
push!(t; reward = 1.0f0, terminal = false)
@test length(t) == 1
end

@testset "ReservoirTrajectory" begin
Expand Down