def __init__(self, gym_id, monitor=None, monitor_safe=False, monitor_video=<NUM_LIT:0>, visualize=False):
self.gym_id = gym_id<EOL>self.gym = gym.make(gym_id)  <EOL>self.visualize = visualize<EOL>if monitor:<EOL><INDENT>if monitor_video == <NUM_LIT:0>:<EOL><INDENT>video_callable = False<EOL><DEDENT>else:<EOL><INDENT>video_callable = (lambda x: x % monitor_video == <NUM_LIT:0>)<EOL><DEDENT>self.gym = gym.wrappers.Monitor(self.gym, monitor, force=not monitor_safe, video_callable=video_callable)<EOL><DEDENT>self._states = OpenAIGym.state_from_space(space=self.gym.observation_space)<EOL>self._actions = OpenAIGym.action_from_space(space=self.gym.action_space)<EOL>
Initialize OpenAI Gym.

Args:
    gym_id: OpenAI Gym environment ID. See https://gym.openai.com/envs
    monitor: Output directory. Setting this to None disables monitoring.
    monitor_safe: Setting this to True prevents existing log files to be overwritten. Default False.
    monitor_video: Save a video every monitor_video steps. Setting this to 0 disables recording of videos.
    visualize: If set True, the program will visualize the trainings of gym's environment. Note that such
        visualization is probabily going to slow down the training.