Note
Go to the end to download the full example code
A demo of MountainCar environment¶
Illustration of MountainCar environment
from rlberry_scool.agents.mbqvi import MBQVIAgent
from rlberry_research.envs.classic_control import MountainCar
from rlberry.wrappers import DiscretizeStateWrapper
_env = MountainCar()
env = DiscretizeStateWrapper(_env, 20)
agent = MBQVIAgent(env, n_samples=40, gamma=0.99)
agent.fit()
env.enable_rendering()
observation, info = env.reset()
for tt in range(200):
action = agent.policy(observation)
observation, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
video = env.save_video("_video/video_plot_montain_car.mp4")
Total running time of the script: (0 minutes 0.000 seconds)