yawning_titan.envs.generic.core.action_loops.ActionLoop#

class yawning_titan.envs.generic.core.action_loops.ActionLoop(env, agent, filename=None, episode_count=None)[source]#

Bases: object

A class that represents different post-training action loops for agents.

Initialise Class.

Parameters:
  • env – The environment to run through

  • agent – The agent to run in the environment

  • filename – The save name for the action lop

  • episode_count – The number of episodes to go through

Methods

generate_gif

Generate GIF from images.

generate_webm

Create webm from image files.

gif_action_loop

Run the agent in evaluation and create a gif from episodes.

random_action_loop

Indefinitely act within the environment taking random actions.

render_cleanup

Delete the frames image files.

standard_action_loop

Indefinitely act within the environment using a trained agent.

gif_action_loop(render_network=True, prompt_to_close=False, save_gif=False, save_webm=False, deterministic=False, gif_output_directory=None, webm_output_directory=None, *args, **kwargs)[source]#

Run the agent in evaluation and create a gif from episodes.

Parameters:
  • render_network – Bool to toggle rendering on or off. Has a default value of True.

  • prompt_to_close – Bool to toggle if the output window should close immediately on loop ending

  • save_gif – Bool to toggle if gif file should be saved to AppData

  • save_webm – Bool to toggle if webm file should be saved to AppData

  • deterministic – Bool to toggle if the agents actions should be deterministic

  • gif_output_directory – Directory where the GIF will be output

  • webm_output_directory – Directory where the WEBM file will be output

standard_action_loop(deterministic=False)[source]#

Indefinitely act within the environment using a trained agent.

random_action_loop(deterministic=False)[source]#

Indefinitely act within the environment taking random actions.

generate_gif(gif_path, frame_names)[source]#

Generate GIF from images.

generate_webm(webm_path, frame_names)[source]#

Create webm from image files.

render_cleanup(frame_names)[source]#

Delete the frames image files.