Initialization

In the __init__ method, we define the initialization parameters along with the action and state spaces, which, as we saw in the previous section, are necessary. The implementation is straight-forward, as follows:

def __init__(self, config=ENV_CONFIG):        self.config = config        self.city = self.config["server_map"].split("/")[-1]        if self.config["enable_planner"]:            self.planner = Planner(self.city)        if config["discrete_actions"]:            self.action_space = Discrete(len(DISCRETE_ACTIONS))        else:            self.action_space = Box(-1.0, 1.0, shape=(2,))        if config["use_depth_camera"]:            image_space = Box(                -1.0, 1.0, shape=(
                    config["y_res"], config["x_res"],                    1 * config["framestack"]))        else:            image_space = Box(                0.0, 255.0, shape=( config["y_res"], config["x_res"], ...

Get Hands-On Intelligent Agents with OpenAI Gym now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.