register.py 398 B

123456789101112131415161718192021
  1. from gym.envs.registration import register as gymRegister
  2. envSet = set()
  3. def register(
  4. id,
  5. entry_point,
  6. reward_threshold=900
  7. ):
  8. assert id.startswith("MiniGrid-")
  9. # Register the environment with OpenAI gym
  10. gymRegister(
  11. id=id,
  12. entry_point=entry_point,
  13. reward_threshold=reward_threshold
  14. )
  15. # Add the environment to the set
  16. envSet.add(id)