MountainCarContinuous-v0¶
ContinuousMountainCar ¶
Bases: Environment[EnvState, EnvParams]
Drive an underpowered car up a hill using a continuous force.
JAX port of the Gymnasium MountainCarContinuous-v0 environment. The car
starts at a uniformly random position in [-0.6, -0.4] with zero velocity.
Supports differentiable transitions via with_transition_gradients().
- Observation:
Boxof shape(2,)with the position and velocity of the car. - Actions:
Boxof shape(1,)with the force on the car, bounded byparams.min_actionandparams.max_action(-1 and 1 by default). Positive values accelerate to the right; actions outside the bounds are clipped. - Reward:
-0.1 * action**2for every step, computed from the action before clipping, plus 100 for the step that reaches the goal. - Termination: the position is at least
params.goal_positionand the velocity at leastparams.goal_velocity. - Truncation: after
params.max_steps_in_episodesteps (999 by default).
References
Parameters and state¶
EnvParams ¶
Bases: EnvParams
Parameters of the ContinuousMountainCar environment.
Attributes:
-
min_action(float) –Lower bound to which the action is clipped.
-
max_action(float) –Upper bound to which the action is clipped.
-
min_position(float) –Lower bound to which the position is clipped.
-
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. A negative velocity is set to 0 while the car is at or beyond it.
-
goal_velocity(float) –Minimum velocity required at the goal for termination.
-
power(float) –Change in velocity per step caused by a unit of clipped action.
-
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 ContinuousMountainCar 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.