MountainCar#

class hybrid_aif.reference.envs.MountainCar[source]#

Bases: Env

Sparse-reward continuous Mountain Car. The dynamics constants are static fields.

power: float = 0.0015#

The force per unit of action, added to the velocity each raw step.

max_speed: float = 0.07#

The bound on the absolute velocity.

min_position: float = -1.2#

The left wall (inelastic: hitting it stops inward velocity).

max_position: float = 0.6#

The right bound on the position.

goal_position: float = 0.45#

The position at or beyond which the goal is reached (termination and success).

gravity: float = 0.0025#

The gravity term, gravity * cos(3 * position) subtracted from the velocity.

action_repeat: int = 2#

The raw steps per agent step (at least 1).

time_limit: int = 100#

The agent steps per episode before truncation (at least 1), read by the collectors.

reset_low: float = -0.6#

The lower end of the uniform reset position.

reset_high: float = -0.4#

The upper end of the uniform reset position.

property num_states: int#

One state factor: the (position, velocity) vector.

physics_step(x, action)[source]#

One raw env step of gymnasium’s MountainCarContinuous dynamics.

reached_goal(state)[source]#

position >= goal_position: the termination predicate and the success flag.

reset(key, params=None)[source]#

position ~ U(-0.6, -0.4), velocity = 0 (gymnasium’s reset).

step(key, state, action, params=None)[source]#

One agent step as the Env face: agent_step() without reward and done.

agent_step(key, state, action, params=None)[source]#

One agent step with the sparse reward: (obs, state, reward, done).

Runs action_repeat raw steps, freezing the state once the goal is reached. reward is −1 per raw step taken before the goal; done is termination at or before this step.

observe(state)[source]#

The observation: the state itself, without noise.

__init__(
power=0.0015,
max_speed=0.07,
min_position=-1.2,
max_position=0.6,
goal_position=0.45,
gravity=0.0025,
action_repeat=2,
time_limit=100,
reset_low=-0.6,
reset_high=-0.4,
)#