Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.13k stars 611 forks source link

Resources providing large datasets of minigrid navigation tasks? #168

Closed francelico closed 2 years ago

francelico commented 2 years ago

Hello,

I was wondering if someone could point me towards some publicly available dataset(s) of minigrid navigation environments?

I am looking for the simplest navigation task specification with walls only (e.g. similar to MiniGrid-FourRooms-v0). Are there some prior works (papers or other format) that provide a dataset with many variations of this environment (e.g. different shapes & number of rooms, mazes, labyriths, rooms + maze-like corridors, ...)? I am looking for a dataset as large and varied as possible, or alternatively several ones that I could combine.

Thank you!

maximecb commented 2 years ago

Hi @francelico,

Each environment has some amount of randomization in it. That means every time you reset the environment for a new episode, you get a new variation of the environment. I haven't computed how many variations exist in total, but it's a lot. You can also control which variation gets generated using a random seed.

francelico commented 2 years ago

Thanks for the reply @maximecb.

I have been playing around with the multiroom (with doors removed) and simple_crossing envs as those are the closest to what I am looking for. However neither will generate deadends or alternate paths to the goal: Screenshot from 2022-02-12 18-08-19 Screenshot from 2022-02-12 18-06-06 Screenshot from 2022-02-12 17-33-35 Screenshot from 2022-02-12 17-36-52

For example, they won't generate "corridor-maze" environments such as Screenshot from 2022-02-12 18-26-51*

Or "room-maze" environments:

Screenshot from 2022-02-12 18-26-42*

Or even a mix of the two:

Screenshot from 2022-02-13 19-43-42

I was wondering whether you were aware of past work providing code to randomly generate these, or even a dataset of many of these sort of environments.

(*) : 1st and 2nd pictures were obtained from Emergent Complexity and Zero-shot Transfer via Unsupervised Environment Design, where they are used as validation environments.

maximecb commented 2 years ago

The authors of these papers must have created their own custom minigrid environments. I would recommend contacting them. Might also be possible to convince them to upstream said environments into minigrid.

francelico commented 2 years ago

So far I've only seen work where they manually create a few as a test set. I am interested in datasets of hundred of these environments, or some code to generate them on the go.

I'll comb through the list of papers on the readme to make sure, but if it doesn't exist yet I might just write the code for it. Is that something you'd be interested in being ported into the main repo?

maximecb commented 2 years ago

If you create maze environments and such I'd be interested in merging them.

micimize commented 2 years ago

Seems like the environments that google research uses for some of their gridworld experiments are under social_rl. The mazes @francelico referenced are generated adversarially with PAIRED in adversarial_env, but I haven't found a link to a generated dataset anywhere.

However, their base MazeEnv accepts a bitmap, and there are plenty of maze generators out there. I'm going to take a crack at combining the bitmap maze env with the random maze generator from mazelab for what I'm working on, and if it pans out I'll see if I can't PR it here

francelico commented 2 years ago

Hi @micimize thanks for the interest. Since my last post I've coded up an implementation generating datasets of mazes and other types of structured layouts. The data generation class is built on the VisionDataset from torchvision to enable easy integration with ML pipelines using pytorch and pytorch-lightning. It also supports encoding the layouts as graphs and is compatible with DGL (Deep Graph Library) for GNN architectures.

I'm still working on the code, with the main remaining effort being to extend the generation process to provide more flexibility in the structured layouts it can generate, for example by using the wave function collapse algorithm. I was hoping to PR all of this at some point next month, perhaps we could work on the PR together if you are working on something similar?

micimize commented 2 years ago

@francelico that sounds very useful – all I've really done is extract the google research MazeEnv and add a basic generator (current code). Was also thinking of integrating mazelib for variety eventually.

My main goal is to use maze generation for training something, but yeah I might be able to help some with your PR if it makes sense. Is it something that makes sense to include in minigrid itself? Guess it depends on how complicated it is.

francelico commented 2 years ago

I may have made it sound more complex than it really is! At its core the code is very simple: it is a layout generator object that can be instantiated to create minigrid layouts according to different algorithms (the maze generating algorithms in mazelib are one of the supported ones).

Then I have some code on top of this generator that was created according to my project's needs. It involves computing metrics, converting the layout to a graphical representation as well as wrapping and saving layouts into a dataset object.

My view is that the layout generator could be a useful addition to minigrid, but perhaps not all of the code I have built on top of it should be included. I haven't given it much thought yet (and in the end it will be up to the maintainers to decide :) )