jurgisp / memory-maze

Evaluating long-term memory of reinforcement learning algorithms
MIT License
129 stars 13 forks source link

Fixed maze every episode, Random agent location #25

Open subho406 opened 1 year ago

subho406 commented 1 year ago

Hey, I'm looking to modify this environment slightly. I'm looking for an environment where the maze does change after every call to the reset (it is fixed based on the seed used to initialize it), but the player location is reset randomly every reset call. Is it possible to do in this in the current implementation or will it require some code changes? Do you have some advice on what changes might be required to get this working.

jurgisp commented 1 year ago

Sorry for delayed reply. You mean the maze does not change, but the player location does?

It would require some code changes for sure. Some pointers:

Alternatively, have you considered keeping the concept of episode <=> single maze, but just spawning the agent in a random location each time it collects a reward? That's what DMLab mazes do. That would be an easier change, I think, and perhaps conceptually cleaner. Because if you keep the maze unchanged over different episodes, then is there a meaning to an "episode" anymore?

Or, if you do want to keep layout of the maze always the same and be that part of the environment definition, then how about just not generating at all, and drawing your own fixed maze? That could also be done by defining your own TextMaze which inherits from labmaze.RandomMaze.

subho406 commented 1 year ago

Spawing the agent in a random location is a great idea, do you know how that is done in the current code? and how I can find the possible agent agents I can to?

jurgisp commented 1 year ago

Try something like

mjcf.get_attachment_frame(self._walker.mjcf_model).pos = (spawn_x, spawn_y)

inside if target.activated ... clause, where self._pick_new_target() is called.