Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

exercise you have to teach the car to reach at the goal position which is at the top of mountain. Number of action spaces is

exercise you have to teach the car to reach at the goal position which is at the top of mountain. Number of action spaces is 3. Action space is discrete in this environment. 0 - move car to left 1 - do nothing 2 - move car to right To begin with this learning environment, import and initialize it as follows: import gym env = gym.make(MountainCar-v0) env.reset() The basic structure of the environment is described by the observation_space and the action_space attributes of the Gym Env class. The observation_space defines the structure as well as the legitimate values for the observation of the state of the environment. The observation can be different things for different environments. The most common form is a screenshot of the game. There can be other forms of observations as well, such as certain characteristics of the environment described in vector form. Similarly, the Env class also defines an attribute called the action_space, which describes the numerical structure of the legitimate actions that can be applied to the environment. You can adopt a strategy that can drive the mountain car taking sequence of allowed actions until it reaches the top of the mountain. Very basic strategy is have a random action: import gym env = gym.make('MountainCar-v0') env.reset() for _ in range(1000): env.render() env.step(env.action_space.sample()) # take a random action env.close()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions