14
14
@test size (b. action) == (sz,)
15
15
16
16
# In EpisodesBuffer
17
- eb = EpisodesBuffer (CircularArraySARTSTraces (capacity= 10 ))
17
+ eb = EpisodesBuffer (CircularArraySARTSATraces (capacity= 10 ))
18
18
push! (eb, (state = 1 , action = 1 ))
19
19
for i = 1 : 5
20
20
push! (eb, (state = i+ 1 , action = i+ 1 , reward = i, terminal = false ))
205
205
@testset " EpisodesSampler" begin
206
206
s = EpisodesSampler ()
207
207
eb = EpisodesBuffer (CircularArraySARTSTraces (capacity= 10 ))
208
- push! (eb, (state = 1 , action = 1 ))
208
+ push! (eb, (state = 1 ,))
209
209
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 ))
211
211
end
212
- push! (eb, (state = 7 , action = 7 ))
212
+ push! (eb, (state = 7 ,))
213
213
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 ))
215
215
end
216
216
217
217
b = sample (s, eb)
218
218
@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 ;]
221
227
222
228
for (j,i) = enumerate (2 : 5 )
223
229
push! (eb, (state = i, action = i, reward = i- 1 , terminal = false ))
241
247
242
248
b = sample (s, eb)
243
249
@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
246
252
@test ! haskey (b[1 ], :action )
247
253
end
248
254
end
0 commit comments