Module pearl.api.agent

Expand source code
from abc import ABC, abstractmethod

from pearl.api.action import Action
from pearl.api.action_result import ActionResult
from pearl.api.action_space import ActionSpace
from pearl.api.observation import Observation


class Agent(ABC):
    """
    An abstract interface for agents.
    """

    @abstractmethod
    def act(self) -> Action:
        pass

    @abstractmethod
    def observe(self, action_result: ActionResult) -> None:
        pass

    @abstractmethod
    def learn(self) -> object:
        pass

    @abstractmethod
    def reset(
        self, observation: Observation, available_action_space: ActionSpace
    ) -> None:
        pass

Classes

class Agent

An abstract interface for agents.

Expand source code
class Agent(ABC):
    """
    An abstract interface for agents.
    """

    @abstractmethod
    def act(self) -> Action:
        pass

    @abstractmethod
    def observe(self, action_result: ActionResult) -> None:
        pass

    @abstractmethod
    def learn(self) -> object:
        pass

    @abstractmethod
    def reset(
        self, observation: Observation, available_action_space: ActionSpace
    ) -> None:
        pass

Ancestors

  • abc.ABC

Subclasses

Methods

def act(self) ‑> torch.Tensor
Expand source code
@abstractmethod
def act(self) -> Action:
    pass
def learn(self) ‑> object
Expand source code
@abstractmethod
def learn(self) -> object:
    pass
def observe(self, action_result: ActionResult) ‑> None
Expand source code
@abstractmethod
def observe(self, action_result: ActionResult) -> None:
    pass
def reset(self, observation: object, available_action_space: ActionSpace) ‑> None
Expand source code
@abstractmethod
def reset(
    self, observation: Observation, available_action_space: ActionSpace
) -> None:
    pass