Skip to content
DeepForgeby svx
All problems

HER Future Goal Pick

Problem

Sample future goals for hindsight relabeling with a seeded random generator.

Draw k indices uniformly from [t + 1, T - 1] using rng.randrange(t + 1, T). Return [] when there is no future timestep.

Hint

The future strategy relabels with states that were actually reached later.

Test cases

case 1
in: [0,5,3,42]
expected: [1,1,3]
case 2
in: [2,6,4,0]
expected: [4,4,3,4]
case 3
in: [3,4,5,7]
expected: []
case 4
in: [1,3,2,123]
expected: [2,2]
Starter codePython
import random
def her_future_goals(t, T, k, seed):
    # Your code here
    pass

4 test cases · run your code against them in the editor