MountainCar-v0¶
MountainCar ¶
Bases: Environment[EnvState, EnvParams]
Drive an underpowered car up a hill by building momentum in a valley.
JAX port of the Gymnasium MountainCar-v0 environment. The car starts at a
uniformly random position in [-0.6, -0.4] with zero velocity.
- Observation:
Boxof shape(2,)with the position and velocity of the car. - Actions:
Discrete(3). 0 accelerates to the left, 1 does not accelerate and 2 accelerates to the right. - Reward: -1 for every step, including the terminating one.
- Termination: the position is at least
params.goal_positionand the velocity at leastparams.goal_velocity. - Truncation: after
params.max_steps_in_episodesteps (200 by default).
References
Parameters and state¶
EnvParams ¶
Bases: EnvParams
Parameters of the MountainCar environment.
Attributes:
-
min_position(float) –Lower bound to which the position is clipped. The velocity is set to 0 when the car reaches it while moving left.
-
max_position(float) –Upper bound to which the position is clipped.
-
max_speed(float) –Maximum absolute velocity of the car.
-
goal_position(float) –Position at or beyond which the goal is reached.
-
goal_velocity(float) –Minimum velocity required at the goal for termination.
-
force(float) –Change in velocity per step caused by accelerating left or right.
-
gravity(float) –Scale of the slope term
cos(3 * position)that is subtracted from the velocity in every step. -
max_steps_in_episode(int) –Number of steps after which the episode is truncated.
EnvState ¶
Bases: EnvState
State of the MountainCar environment.
Attributes:
-
position(Array) –Position of the car, clipped to
[params.min_position, params.max_position]. -
velocity(Array) –Velocity of the car, clipped to
[-params.max_speed, params.max_speed]. -
time(int) –Number of steps taken in the current episode.