Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure ObstructedMaze is solvable. #334

Merged
merged 8 commits into from
Mar 21, 2023

Conversation

SigmaBM
Copy link
Contributor

@SigmaBM SigmaBM commented Mar 14, 2023

Description

The blocking ball placed by the add_door may cover the box placed on the map by previous add_door, causing the agent to be unable to open certain door and unable to complete the task. To make sure this environment solvable, we can first place all the doors and their blocking balls, and then place the keys, so that it ensures that the keys will not be covered by the blocking balls added later.

Fixes # 323

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you

  1. Provide a test to show the number of environments that are not solvable out of 10,000?
  2. update the version numbers for all Obstructed Maze
  3. Add a test to check if the environment is solvable and run 10 times in the tests.

@SigmaBM
Copy link
Contributor Author

SigmaBM commented Mar 19, 2023

Could you please clarify if "update the version numbers" means changing from "v0" to "v1"? Also, which directory should I place the test files? Thank you.

@pseudo-rnd-thoughts
Copy link
Member

Could you please clarify if "update the version numbers" means changing from "v0" to "v1"? Also, which directory should I place the test files? Thank you.

Yes, just updated the registration version number, see minigrid/__init__.py I believe and also update the documentation for the changes from v0 to v1

For testing, could you put it in tests/test_obstructed_maze.py

@SigmaBM
Copy link
Contributor Author

SigmaBM commented Mar 19, 2023

I update the version number of related ObstructedMaze envs and the document. A test file is available in tests/test_obstructed_maze.py.

@@ -58,16 +58,21 @@ class ObstructedMazeEnv(RoomGrid):
"Q" number of quarters that will have doors and keys out of the 9 that the
map already has.
"Full" 3x3 maze with "h" and "b" options.
"v1" prevent the key from being covered by the blocking ball.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update to explain why only some of the environments are updated

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test, test_solvable_env that the env_test for the v1 envs have a unsolvable == 0

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this is good.

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit 83731bd into Farama-Foundation:master Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants