Views
No views yet
1from stable_baselines3 import PPO
2import gymnasium as gym
3
4# Load the trained model
5model = PPO.load("best_model.zip")
6
7# Create environment
8env = gym.make("MiniGrid-fill_20")
9
10# Enjoy the trained agent
11obs, info = env.reset()
12for _ in range(1000):
13 action, _ = model.predict(obs, deterministic=True)
14 obs, reward, terminated, truncated, info = env.step(action)
15 if terminated or truncated:
16 obs, info = env.reset()1env:
2 act:
3 key:
4 - LEFT
5 - RIGHT
6 - UP
7 - DOWN
8 - SPACE
9 movement:
10 - L
11 - R
12 - U
13 - D
14 - TOGGLE
15 model:
16 load:
17 dt: 1.0e-05
18 power: 1
19 sigma: 5.0e-05
20 speed: 5
21 type: point
22 mesh:
23 length:
24 - 0.001
25 - 0.001
26 n_elements:
27 - 20
28 - 20
29 state:
30 melt_temp:
31 expr: melt_temp
32 init: 0.99
33 type: parameter
34 phase:
35 expr: (temp > melt_temp) | phase
36 init: false
37 type: derived
38 temp:
39 expr: temp
40 init: 0.0
41 type: primary
42 obs:
43 state:
44 - phase
45 - load
46 - mask
47best_model.zip: The trained model checkpointvecnormalize.pkl: Vector normalization statistics (if applicable)1@misc{ctrlp-zoo,
2 author = {Schmeitz, R.},
3 title = {CTRL-P Zoo: Reinforcement Learning Model Repository},
4 year = {2026},
5 publisher = {GitHub},
6 journal = {GitHub repository},
7 howpublished = {\url{https://github.com/RSchmeitz/ctrlp-zoo}}
8}