training_ml_control.environments.utils#

Module Contents#

Classes#

SimulationResults

Functions#

create_cart_environment

Creates instance of CartEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

create_pendulum_environment

Creates instance of PendulumEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

create_grid_world_environment

Creates instance of GridWorldEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

create_inverted_pendulum_environment

Creates instance of InvertedPendulumEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

simulate_environment

value_iteration

compute_best_path_and_actions_from_values

Data#

__all__

API#

training_ml_control.environments.utils.__all__#

[‘create_inverted_pendulum_environment’, ‘create_grid_world_environment’, ‘create_cart_environment’,…

training_ml_control.environments.utils.create_cart_environment(render_mode: str | None = 'rgb_array', *, max_steps: int = 200, goal_velocity: float = 0, max_position: float = 10, max_speed: float = 10, max_force: float = 10, goal_position: float = 9.0) gymnasium.Env[source]#

Creates instance of CartEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

training_ml_control.environments.utils.create_pendulum_environment(render_mode: str | None = 'rgb_array', *, max_steps: int = 200) gymnasium.Env[source]#

Creates instance of PendulumEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

training_ml_control.environments.utils.create_grid_world_environment(render_mode: str | None = 'rgb_array', *, max_steps: int = 20) gymnasium.Env[source]#

Creates instance of GridWorldEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

training_ml_control.environments.utils.create_inverted_pendulum_environment(render_mode: str | None = 'rgb_array', *, max_steps: int = 500, masspole: float | None = None, masscart: float | None = None, length: float | None = None, x_threshold: float = 3, theta_initial: float = 0.0, theta_threshold: float = 24, force_max: float = 10.0) gymnasium.Env[source]#

Creates instance of InvertedPendulumEnv with some wrappers to ensure correctness, limit the number of steps and store rendered frames.

Args: render_mode: Render mode for environment. max_steps: Maximum number of steps in the environment before termination. masspole: mass of the pole. masscart: mass of the cart. length: length of the pole. force_max: maximum absolute value for force applied to Cart. x_threshold: Threshold value for cart position. theta_threshold: Threshold value for pole angle.

Returns: Instantiated and wrapped environment.

class training_ml_control.environments.utils.SimulationResults[source]#
frames: list[numpy.typing.NDArray]#

None

observations: numpy.typing.NDArray#

None

estimated_observations: numpy.typing.NDArray#

None

actions: numpy.typing.NDArray#

None

training_ml_control.environments.utils.simulate_environment(env: gymnasium.Env, *, max_steps: int = 500, controller: training_ml_control.control.FeedbackController | None = None, observer: training_ml_control.control.Observer | None = None, seed: int = 16) training_ml_control.environments.utils.SimulationResults[source]#
training_ml_control.environments.utils.value_iteration(G: networkx.DiGraph) dict[tuple[int, int], float][source]#
training_ml_control.environments.utils.compute_best_path_and_actions_from_values(G: networkx.DiGraph, start_node: tuple[int, int], target_node: tuple[int, int], values: dict[tuple[int, int], float]) tuple[list[tuple[int, int]], list[int]][source]#