Farama-Foundation / D4RL

A collection of reference environments for offline reinforcement learning
Apache License 2.0
1.35k stars 285 forks source link

Is there any way that can let the goal location fixed? and can set the loctaion personally? #212

Open GuochenZhou opened 1 year ago

GuochenZhou commented 1 year ago

Question

Is there any way that can let the goal location fixed? and can set the loctaion personally?

AlexBeesonWarwick commented 1 year ago

Hi there

I've found that for AntMaze, you can get the current target goal using: env.target_goal

You can set the target goal using: env.set_target_goal(new_goal) where "new_goal" is user specified. Note this has to be done after env.reset(). I haven't yet been able to figure out how to get the dimensions of the maze or the whole set of x-y coordinates that are permitted (e.g. not a wall), however you can get a sub-set of permitted x-y coordinates using the states in the data. You can randomly select a state and use that for the new_goal using something like: dataset["observations"][np.random.randint(0, len(dataset["observations"]))][0:2]

Hope that helps

Alex