Question
In this exercise you have to teach the car to reach at the goal position which is at the top of mountain. Number of action
In this 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()
In this exercise you are requested to experiment with two strategies and to compare their achievement
In this 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.reset0 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.reset0 for _ in range(1000): env.render0 env.step(env.action_space.sample0) \# take a random actionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started