Base Agent
The base inherited class for any agent used in CybORG.
This class acts as an abstract class that enforces the implementation of the agent choosing an actions. It also provides placeholder functions for use when/if the agent: learns a policy, set initial values, or update its internal state.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
agent name |
np_random |
(Tuple[np.random.Generator, Any], optional)
|
contains a RNG and the seed |
Functions
__init__
Initialises the instance with a given name and rnadom number generator (RNG)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
agent name |
required |
np_random |
Tuple[np.random.Generator, Any]
|
contains a RNG and the seed, usually omitted |
None
|
end_episode
Allows an agent to update its internal state.
Raises: NotImplementedError: The class inheriting BaseAgent has not implemented this function
get_action
Gets the agent's action for that step.
The function gets an action from the agent that should be performed based on the agent's internal state and provided observation and action space. The contents is left empty to be overwritten by the class that inherits BaseAgent.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
observation |
dict
|
the 'data' dictionary contained within the Observation object |
required |
action_space |
dict
|
a dictionary representation of the Action_Space object |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
The class inheriting BaseAgent has not implemented this function |
set_initial_values
Allows the agent to set initial values when the AgentInterface object is first defined.
This function is very rarely used and commonly passed in agent implementation.
Raises:
Type | Description |
---|---|
NotImplementedError
|
The class inheriting BaseAgent has not implemented this function |
train
Allows an agent to learn a policy
Function is left empty to be overwritten by the class that inherits BaseAgent. If the agent is deterministic (e.g. a heuristic agent), then this function will usually be passed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
results |
Results
|
class object that holds the consequences or 'results' of the agent's action |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
The class inheriting BaseAgent has not implemented this function |