Mountain Car
lerax.env.MountainCar
Bases:
Mountain Car environment matching the Gymnasium MountainCar environment.
Note
To achieve identical dynamics to Gymnasium set solver=diffrax.Euler().
Action Space
The action space is discrete with 3 actions:
- 0: Push left
- 1: No push
- 2: Push right
The action applies a fixed magnitude force to the car in the specified direction for the duration of the time step.
Observation Space
The observation space is a 2-dimensional continuous space representing the position and velocity of the car:
| Index | Observation | Min Value | Max Value |
|---|---|---|---|
| 0 | Car Position | -1.2 | 0.6 |
| 1 | Car Velocity | -0.07 | 0.07 |
These values reflect the physical limits of the environment.
These limits can be modified via the min_position, max_position, and max_speed parameters.
Reward
The reward is -1 for every step taken until the goal position is reached.
Termination
The episode terminates when the car reaches the goal position of 0.5 with a velocity of at least 0.0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_position
|
|
Minimum position of the car. |
-1.2
|
max_position
|
|
Maximum position of the car. |
0.6
|
max_speed
|
|
Maximum speed of the car. |
0.07
|
goal_position
|
|
Position at which the episode terminates. |
0.5
|
goal_velocity
|
|
Minimum velocity at the goal position to terminate the episode. |
0.0
|
force
|
|
Magnitude of the force applied when pushing the car. |
0.001
|
gravity
|
|
Gravity constant affecting the car's movement. |
0.0025
|
dt
|
|
Time step for the environment dynamics. |
1.0
|
solver
|
|
Diffrax solver to use for integrating the dynamics. |
None
|
stepsize_controller
|
|
Step size controller for adaptive solvers. |
None
|