|
Download com.unity.ml-agents/Documentation~/Python-PettingZoo-API-Documentation.md from ashish2244/ppo-SnowballTarget: direct link, hf CLI and curl.
- Browser
- Download file 5.41 kB
-
https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents/Documentation~/Python-PettingZoo-API-Documentation.md
- Command line
-
hf download 'hf://ashish2244/ppo-SnowballTarget/com.unity.ml-agents/Documentation~/Python-PettingZoo-API-Documentation.md'
-
curl -L -o Python-PettingZoo-API-Documentation.md 'https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents/Documentation~/Python-PettingZoo-API-Documentation.md'
5.41 kB
| # Python PettingZoo API Documentation | |
| <a name="mlagents_envs.envs.pettingzoo_env_factory"></a> | |
| # mlagents\_envs.envs.pettingzoo\_env\_factory | |
| <a name="mlagents_envs.envs.pettingzoo_env_factory.PettingZooEnvFactory"></a> | |
| ## PettingZooEnvFactory Objects | |
| ```python | |
| class PettingZooEnvFactory() | |
| ``` | |
| <a name="mlagents_envs.envs.pettingzoo_env_factory.PettingZooEnvFactory.env"></a> | |
| #### env | |
| ```python | |
| | env(seed: Optional[int] = None, **kwargs: Union[List, int, bool, None]) -> UnityAECEnv | |
| ``` | |
| Creates the environment with env_id from unity's default_registry and wraps it in a UnityToPettingZooWrapper | |
| **Arguments**: | |
| - `seed`: The seed for the action spaces of the agents. | |
| - `kwargs`: Any argument accepted by `UnityEnvironment`class except file_name | |
| <a name="mlagents_envs.envs.unity_aec_env"></a> | |
| # mlagents\_envs.envs.unity\_aec\_env | |
| <a name="mlagents_envs.envs.unity_aec_env.UnityAECEnv"></a> | |
| ## UnityAECEnv Objects | |
| ```python | |
| class UnityAECEnv(UnityPettingzooBaseEnv, AECEnv) | |
| ``` | |
| Unity AEC (PettingZoo) environment wrapper. | |
| <a name="mlagents_envs.envs.unity_aec_env.UnityAECEnv.__init__"></a> | |
| #### \_\_init\_\_ | |
| ```python | |
| | __init__(env: BaseEnv, seed: Optional[int] = None) | |
| ``` | |
| Initializes a Unity AEC environment wrapper. | |
| **Arguments**: | |
| - `env`: The UnityEnvironment that is being wrapped. | |
| - `seed`: The seed for the action spaces of the agents. | |
| <a name="mlagents_envs.envs.unity_aec_env.UnityAECEnv.step"></a> | |
| #### step | |
| ```python | |
| | step(action: Any) -> None | |
| ``` | |
| Sets the action of the active agent and get the observation, reward, termination, truncation and info of the next agent. | |
| **Arguments**: | |
| - `action`: The action for the active agent | |
| <a name="mlagents_envs.envs.unity_aec_env.UnityAECEnv.observe"></a> | |
| #### observe | |
| ```python | |
| | observe(agent_id) | |
| ``` | |
| Returns the observation an agent currently can make. `last()` calls this function. | |
| <a name="mlagents_envs.envs.unity_aec_env.UnityAECEnv.last"></a> | |
| #### last | |
| ```python | |
| | last(observe=True) | |
| ``` | |
| returns observation, cumulative reward, termination, truncation, info for the current agent (specified by self.agent_selection) | |
| <a name="mlagents_envs.envs.unity_parallel_env"></a> | |
| # mlagents\_envs.envs.unity\_parallel\_env | |
| <a name="mlagents_envs.envs.unity_parallel_env.UnityParallelEnv"></a> | |
| ## UnityParallelEnv Objects | |
| ```python | |
| class UnityParallelEnv(UnityPettingzooBaseEnv, ParallelEnv) | |
| ``` | |
| Unity Parallel (PettingZoo) environment wrapper. | |
| <a name="mlagents_envs.envs.unity_parallel_env.UnityParallelEnv.__init__"></a> | |
| #### \_\_init\_\_ | |
| ```python | |
| | __init__(env: BaseEnv, seed: Optional[int] = None) | |
| ``` | |
| Initializes a Unity Parallel environment wrapper. | |
| **Arguments**: | |
| - `env`: The UnityEnvironment that is being wrapped. | |
| - `seed`: The seed for the action spaces of the agents. | |
| <a name="mlagents_envs.envs.unity_parallel_env.UnityParallelEnv.reset"></a> | |
| #### reset | |
| ```python | |
| | reset() -> Dict[str, Any] | |
| ``` | |
| Resets the environment. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env"></a> | |
| # mlagents\_envs.envs.unity\_pettingzoo\_base\_env | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv"></a> | |
| ## UnityPettingzooBaseEnv Objects | |
| ```python | |
| class UnityPettingzooBaseEnv() | |
| ``` | |
| Unity Petting Zoo base environment. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.observation_spaces"></a> | |
| #### observation\_spaces | |
| ```python | |
| | @property | |
| | observation_spaces() -> Dict[str, spaces.Space] | |
| ``` | |
| Return the observation spaces of all the agents. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.observation_space"></a> | |
| #### observation\_space | |
| ```python | |
| | observation_space(agent: str) -> Optional[spaces.Space] | |
| ``` | |
| The observation space of the current agent. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.action_spaces"></a> | |
| #### action\_spaces | |
| ```python | |
| | @property | |
| | action_spaces() -> Dict[str, spaces.Space] | |
| ``` | |
| Return the action spaces of all the agents. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.action_space"></a> | |
| #### action\_space | |
| ```python | |
| | action_space(agent: str) -> Optional[spaces.Space] | |
| ``` | |
| The action space of the current agent. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.side_channel"></a> | |
| #### side\_channel | |
| ```python | |
| | @property | |
| | side_channel() -> Dict[str, Any] | |
| ``` | |
| The side channels of the environment. You can access the side channels of an environment with `env.side_channel[<name-of-channel>]`. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.reset"></a> | |
| #### reset | |
| ```python | |
| | reset(seed: Optional[int] = None, options: Optional[Dict] = None) -> Any | |
| ``` | |
| Resets the environment. | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.render"></a> | |
| #### render | |
| ```python | |
| | render() | |
| ``` | |
| NOT SUPPORTED. | |
| Renders the environment as specified by self.render_mode, if supported. | |
| Render mode can be `human` to display a window. Other render modes in the default environments are `'rgb_array'` which returns a numpy array and is supported by all environments outside of classic, and `'ansi'` which returns the strings printed (specific to classic environments). | |
| <a name="mlagents_envs.envs.unity_pettingzoo_base_env.UnityPettingzooBaseEnv.close"></a> | |
| #### close | |
| ```python | |
| | close() -> None | |
| ``` | |
| Close the environment. | |