File size: 1,856 Bytes
e11e4fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from abc import abstractmethod
from typing import Any, Optional
from mlagents_envs.base_env import BaseEnv


class BaseRegistryEntry:
    def __init__(
        self,
        identifier: str,
        expected_reward: Optional[float],
        description: Optional[str],
    ):
        """
        BaseRegistryEntry allows launching a Unity Environment with its make method.
        :param identifier: The name of the Unity Environment.
        :param expected_reward: The cumulative reward that an Agent must receive
        for the task to be considered solved.
        :param description: A description of the Unity Environment. Contains human
        readable information about potential special arguments that the make method can
        take as well as information regarding the observation, reward, actions,
        behaviors and number of agents in the Environment.
        """
        self._identifier = identifier
        self._expected_reward = expected_reward
        self._description = description

    @property
    def identifier(self) -> str:
        """
        The unique identifier of the entry
        """
        return self._identifier

    @property
    def expected_reward(self) -> Optional[float]:
        """
        The cumulative reward that an Agent must receive for the task to be considered
        solved.
        """
        return self._expected_reward

    @property
    def description(self) -> Optional[str]:
        """
        A description of the Unity Environment the entry can make.
        """
        return self._description

    @abstractmethod
    def make(self, **kwargs: Any) -> BaseEnv:
        """
        This method creates a Unity BaseEnv (usually a UnityEnvironment).
        """
        raise NotImplementedError(
            f"The make() method not implemented for entry {self.identifier}"
        )