Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions examples/gym-cartpole/smart_agent.zls
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ let proba model obs_gym = action where
rec obs = simple_pendulum (obs_gym, (Right fby action))
and action = controller (obs)
and () = Infer_pf.factor (-10. *. (abs_float (obs.pole_angle)))
and display = draw_obs_back obs

let node smart_main () = () where
rec reset action = Infer_pf.plan 10 10 model obs every true
rec reset action = Infer_pf.plan_pf 30 10 10 model obs every true
and obs, _, stop = cart_pole_gym true (Right fby action)
and display = draw_obs_front obs
4 changes: 1 addition & 3 deletions examples/gym-cartpole/smart_pid_agent.zls
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ let proba smart_model (obs_gym) = action where
rec obs = simple_pendulum (obs_gym, (Right fby action))
and action = smart_controller (obs)
and () = Infer_pf.factor (-10. *. (abs_float (obs.pole_angle)))
and display = draw_obs_back obs


(** PID controller for the cart-pole example **)
Expand All @@ -72,11 +71,10 @@ let proba pid_model (obs, ctrl_action) = p, (i, d) where


let node smart_pid_main () = () where
rec reset action_smart = Infer_pf.plan 10 10 smart_model obs_smart
rec reset action_smart = Infer_pf.plan_pf 30 10 10 smart_model obs_smart
every true
and obs_smart, _, _ = cart_pole_gym true (Right fby action_smart)
and pid_dist = Infer_pf.infer 1000 pid_model (obs_smart, action_smart)
and () = draw_obs_front obs_smart
and (p, (i, d)) = Distribution.draw pid_dist
and obs, _, stop = cart_pole_gym true (Right fby action)
and reset action = pid_controller (obs.pole_angle, (p, i, d))
Expand Down
Loading