1414 @test size (b. action) == (sz,)
1515
1616 # In EpisodesBuffer
17- eb = EpisodesBuffer (CircularArraySARTSTraces (capacity= 10 ))
17+ eb = EpisodesBuffer (CircularArraySARTSATraces (capacity= 10 ))
1818 push! (eb, (state = 1 , action = 1 ))
1919 for i = 1 : 5
2020 push! (eb, (state = i+ 1 , action = i+ 1 , reward = i, terminal = false ))
205205 @testset " EpisodesSampler" begin
206206 s = EpisodesSampler ()
207207 eb = EpisodesBuffer (CircularArraySARTSTraces (capacity= 10 ))
208- push! (eb, (state = 1 , action = 1 ))
208+ push! (eb, (state = 1 ,))
209209 for i = 1 : 5
210- push! (eb, (state = i+ 1 , action = i+ 1 , reward = i, terminal = false ))
210+ push! (eb, (state = i+ 1 , action = i, reward = i, terminal = false ))
211211 end
212- push! (eb, (state = 7 , action = 7 ))
212+ push! (eb, (state = 7 ,))
213213 for (j,i) = enumerate (8 : 12 )
214- push! (eb, (state = i, action = i, reward = i- 1 , terminal = false ))
214+ push! (eb, (state = i, action = i- 1 , reward = i- 1 , terminal = false ))
215215 end
216216
217217 b = sample (s, eb)
218218 @test length (b) == 2
219- @test length (b[1 ][:state ]) == 5
220- @test length (b[2 ][:state ]) == 6
219+ @test b[1 ][:state ] == [2 : 5 ;]
220+ @test b[1 ][:next_state ] == [3 : 6 ;]
221+ @test b[1 ][:action ] == [2 : 5 ;]
222+ @test b[1 ][:reward ] == [2 : 5 ;]
223+ @test b[2 ][:state ] == [7 : 11 ;]
224+ @test b[2 ][:next_state ] == [8 : 12 ;]
225+ @test b[2 ][:action ] == [7 : 11 ;]
226+ @test b[2 ][:reward ] == [7 : 11 ;]
221227
222228 for (j,i) = enumerate (2 : 5 )
223229 push! (eb, (state = i, action = i, reward = i- 1 , terminal = false ))
241247
242248 b = sample (s, eb)
243249 @test length (b) == 2
244- @test length (b[1 ][:state ]) == 5
245- @test length (b[2 ][:state ]) == 6
250+ @test length (b[1 ][:state ]) == 4
251+ @test length (b[2 ][:state ]) == 5
246252 @test ! haskey (b[1 ], :action )
247253 end
248254end
0 commit comments