Navigation
API > API/Plugins > API/Plugins/LearningAgents
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- ULearningAgentsManagerComponent
- ULearningAgentsInteractor
References
| Module | LearningAgents |
| Header | /Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Public/LearningAgentsInteractor.h |
| Include | #include "LearningAgentsInteractor.h" |
Syntax
UCLASS&40;Abstract, BlueprintType, Blueprintable&41;
class ULearningAgentsInteractor : public ULearningAgentsManagerComponent
Remarks
ULearningAgentsInteractor defines how agents interact with the environment through their observations and actions. Additionally, it provides methods to be called during the inference process of those agents.
To use this class, you need to implement the SetupObservations and SetupActions functions (as well as their corresponding SetObservations and SetActions functions), which will define the size of inputs and outputs to your policy. Before you can do inference, you need to call SetupInteractor, which will initialize the underlying data structure, and you need to call AddAgent for each object you want controlled by this agent interactor.
Constructors
| Type | Name | Description | |
|---|---|---|---|
| These constructors/destructors are needed to make forward declarations happy. | |||
ULearningAgentsInteractor
(
FVTableHelper& Helper |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddAction
(
TObjectPtr< ULearningAgentsAction > Object, |
Used by objects derived from ULearningAgentsAction to add themselves to this agent interactor during their creation. | |
| void | AddObservation
(
TObjectPtr< ULearningAgentsObservation > Object, |
Used by objects derived from ULearningAgentsObservation to add themselves to this agent interactor during their creation. | |
| void | DecodeActions
(
const UE::Learning::FIndexSet AgentSet |
Decode Actions for a specific set of agents | |
| void | Call this function when it is time for your agents to take their actions. | ||
| void | EncodeObservations
(
const UE::Learning::FIndexSet AgentSet |
Encode Observations for a specific set of agents | |
| void | Encoding / Decoding | ||
| TLearningArrayView< 1, uint64 > | Get the number of times actions have been encoded for all agents | ||
| UE::Learning::FFeatureObject & | Get a reference to this agent interactor's action feature. | ||
| TConstArrayView< ULearningAgentsAction * > | Get a const array view of this agent interactor's action objects. | ||
| void | GetActions
(
const TArray< int32 >& AgentIds |
During this event, you should retrieve the actions and apply them to your agents. | |
| void | GetActionVector
(
const int32 AgentId, |
Gets the action vector used by a given agent. | |
| TLearningArrayView< 1, uint64 > | Get the number of times observations have been encoded for all agents | ||
| UE::Learning::FFeatureObject & | Non-blueprint public interface | ||
| TConstArrayView< ULearningAgentsObservation * > | Get a const array view of this agent interactor's observation objects. | ||
| void | GetObservationVector
(
const int32 AgentId, |
Gets the observation vector used by a given agent. Should be called only after EncodeObservations. | |
| void | SetObservations
(
const TArray< int32 >& AgentIds |
During this event, all observations should be set for each agent. | |
| void | SetupActions () |
Actions | |
| void | Initializes this object and runs the setup events for observations and actions. | ||
| void | Observations |
Overridden from ULearningAgentsManagerComponent
| Type | Name | Description | |
|---|---|---|---|
| void | OnAgentsAdded
(
const TArray< int32 >& AgentIds |
Called whenever agents are added to the parent ALearningAgentsManager object. | |
| void | OnAgentsRemoved
(
const TArray< int32 >& AgentIds |
Called whenever agents are removed from the parent ALearningAgentsManager object. | |
| void | OnAgentsReset
(
const TArray< int32 >& AgentIds |
Called whenever agents are reset on the parent ALearningAgentsManager object. |