Skip to content

swarmrl.exploration_policies.exploration_policy Module API Reference

Parent class for exploration modules.

ExplorationPolicy

Parent class for exploration policies.

Source code in swarmrl/exploration_policies/exploration_policy.py
 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
class ExplorationPolicy:
    """
    Parent class for exploration policies.
    """

    def __call__(
        self, model_actions: np.ndarray, action_space_length: int
    ) -> np.ndarray:
        """
        Return an index associated with the chosen action.

        Parameters
        ----------
        model_actions : np.ndarray (n_colloids,)
                Action chosen by the model for each colloid.
        action_space_length : int
                Number of possible actions. Should be 1 higher than the actual highest
                index, i.e if I have actions [0, 1, 2, 3] this number should be 4.

        Returns
        -------
        action : np.ndarray
                Action chosen after the exploration module has operated for
                each colloid.
        """
        raise NotImplementedError

__call__(model_actions, action_space_length)

Return an index associated with the chosen action.

Parameters

model_actions : np.ndarray (n_colloids,) Action chosen by the model for each colloid. action_space_length : int Number of possible actions. Should be 1 higher than the actual highest index, i.e if I have actions [0, 1, 2, 3] this number should be 4.

Returns

action : np.ndarray Action chosen after the exploration module has operated for each colloid.

Source code in swarmrl/exploration_policies/exploration_policy.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
def __call__(
    self, model_actions: np.ndarray, action_space_length: int
) -> np.ndarray:
    """
    Return an index associated with the chosen action.

    Parameters
    ----------
    model_actions : np.ndarray (n_colloids,)
            Action chosen by the model for each colloid.
    action_space_length : int
            Number of possible actions. Should be 1 higher than the actual highest
            index, i.e if I have actions [0, 1, 2, 3] this number should be 4.

    Returns
    -------
    action : np.ndarray
            Action chosen after the exploration module has operated for
            each colloid.
    """
    raise NotImplementedError