Navigation
API > API/Plugins > API/Plugins/LearningAgents
ULearningAgentsInteractor defines how agents interact with the environment through their observations and actions.
To use this class, you need to implement SpecifyAgentObservation_ and SpecifyAgentAction_, which will define the structure of inputs and outputs to your policy. You also need to implement GatherAgentObservation_ and PerformAgentAction_ which will dictate how those observations are gathered, and actions actuated in your environment.
| Name | ULearningAgentsInteractor |
| Type | class |
| Header File | /Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Public/LearningAgentsInteractor.h |
| Include Path | #include "LearningAgentsInteractor.h" |
Syntax
UCLASS (MinimalAPI, Abstract, HideDropDown, BlueprintType, Blueprintable)
class ULearningAgentsInteractor : public ULearningAgentsManagerListener
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → ULearningAgentsManagerListener → ULearningAgentsInteractor
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| These constructors/destructors are needed to make forward declarations happy. | LearningAgentsInteractor.h | ||
ULearningAgentsInteractor
(
FVTableHelper& Helper |
LearningAgentsInteractor.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ULearningAgentsInteractor() |
LearningAgentsInteractor.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActionCompatibilityHash | int32 | Compatibility Hash for Action Schema | LearningAgentsInteractor.h | |
| ActionModifier | TObjectPtr< ULearningAgentsActionModifier > | Action Modifier used by this interactor | LearningAgentsInteractor.h |
|
| ActionModifierElements | TArray< FLearningAgentsActionModifierElement > | Action Modifier Elements used by this interactor | LearningAgentsInteractor.h |
|
| ActionModifierVectorIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times action modifier vector has been set for all agents | LearningAgentsInteractor.h | |
| ActionModifierVectors | TLearningArray< 2, float > | Buffer of Action Modifier Vectors for each agent | LearningAgentsInteractor.h | |
| ActionObject | TObjectPtr< ULearningAgentsActionObject > | Action Object used by this interactor | LearningAgentsInteractor.h |
|
| ActionObjectElements | TArray< FLearningAgentsActionObjectElement > | Action Object Elements used by this interactor | LearningAgentsInteractor.h |
|
| ActionSchema | TObjectPtr< ULearningAgentsActionSchema > | Action Schema used by this interactor | LearningAgentsInteractor.h |
|
| ActionSchemaElement | FLearningAgentsActionSchemaElement | Action Schema Element used by this interactor | LearningAgentsInteractor.h |
|
| ActionVectorIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times action vector has been set for all agents | LearningAgentsInteractor.h | |
| ActionVectors | TLearningArray< 2, float > | Buffer of Action Vectors for each agent | LearningAgentsInteractor.h | |
| ObservationCompatibilityHash | int32 | Compatibility Hash for Observation Schema | LearningAgentsInteractor.h | |
| ObservationObject | TObjectPtr< ULearningAgentsObservationObject > | Observation Object used by this interactor | LearningAgentsInteractor.h |
|
| ObservationObjectElements | TArray< FLearningAgentsObservationObjectElement > | Observation Object Elements used by this interactor | LearningAgentsInteractor.h |
|
| ObservationSchema | TObjectPtr< ULearningAgentsObservationSchema > | Observation Schema used by this interactor | LearningAgentsInteractor.h |
|
| ObservationSchemaElement | FLearningAgentsObservationSchemaElement | Observation Schema Element used by this interactor | LearningAgentsInteractor.h |
|
| ObservationVectorIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times observation vector has been set for all agents | LearningAgentsInteractor.h | |
| ObservationVectors | TLearningArray< 2, float > | --Private Data -- | LearningAgentsInteractor.h | |
| ValidAgentIds | TArray< int32 > | Temp buffers used to record the set of agents that are valid for encoding/decoding | LearningAgentsInteractor.h | |
| ValidAgentSet | UE::Learning::FIndexSet | LearningAgentsInteractor.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void GatherAgentObservation
(
FLearningAgentsObservationObjectElement& OutObservationObjectElement, |
This callback should be overridden by the Interactor and gathers the observations for a single agent. | LearningAgentsInteractor.h |
|
void GatherAgentObservations
(
TArray< FLearningAgentsObservationObjectElement >& OutObservationObjectElements, |
This callback can be overridden by the Interactor and gathers all the observations for the given agents. | LearningAgentsInteractor.h |
|
void GatherObservations
(
const UE::Learning::FIndexSet AgentSet, |
-- Non-blueprint public interface -- | LearningAgentsInteractor.h | |
void GatherObservations () |
-- Blueprint public interface -- | LearningAgentsInteractor.h |
|
int32 GetActionDistributionVectorSize() |
Gets the size of the action distribution vector used by this interactor. | LearningAgentsInteractor.h |
|
int32 GetActionEncodedVectorSize() |
Gets the size of the encoded action vector used by this interactor. | LearningAgentsInteractor.h |
|
uint64 GetActionIteration
(
const int32 AgentId |
Gets the action iteration value for the given agent id. | LearningAgentsInteractor.h | |
const ULearningAgentsActionModifier * GetActionModifier() |
Gets the action modifier. | LearningAgentsInteractor.h | |
const TArray< FLearningAgentsActionModifierElement > & GetActionModifierElements() |
Gets the action modifier elements. | LearningAgentsInteractor.h | |
uint64 GetActionModifierIteration
(
const int32 AgentId |
Gets the action modifier iteration value for the given agent id. | LearningAgentsInteractor.h | |
void GetActionModifierVector
(
TArray< float >& OutActionModifierVector, |
Get the current buffered action modifier vector for the given agent. | LearningAgentsInteractor.h |
|
TLearningArrayView< 2, const float > GetActionModifierVectorsArrayView() |
Gets the action modifier vectors as a const array view. | LearningAgentsInteractor.h | |
int32 GetActionModifierVectorSize() |
Gets the size of the action modifier vector used by this interactor. | LearningAgentsInteractor.h |
|
ULearningAgentsActionObject * GetActionObject() |
Gets the action object. | LearningAgentsInteractor.h | |
TArray< FLearningAgentsActionObjectElement > & GetActionObjectElements() |
Gets the action object elements. | LearningAgentsInteractor.h | |
const ULearningAgentsActionSchema * GetActionSchema() |
Gets the action schema object | LearningAgentsInteractor.h | |
const FLearningAgentsActionSchemaElement GetActionSchemaElement() |
Gets the action schema element | LearningAgentsInteractor.h | |
void GetActionVector
(
TArray< float >& OutActionVector, |
Get the current buffered action vector for the given agent. | LearningAgentsInteractor.h |
|
TLearningArrayView< 1, uint64 > GetActionVectorIterationArrayView() |
Gets the action vector iterations as a mutable array view. | LearningAgentsInteractor.h | |
TLearningArrayView< 2, float > GetActionVectorsArrayView () |
Gets the action vectors as a mutable array view. | LearningAgentsInteractor.h | |
TLearningArrayView< 2, const float > GetActionVectorsArrayView () |
Gets the action vectors as a const array view. | LearningAgentsInteractor.h | |
int32 GetActionVectorSize() |
Gets the size of the action vector used by this interactor. | LearningAgentsInteractor.h |
|
int32 GetObservationEncodedVectorSize() |
Gets the size of the encoded observation vector used by this interactor. | LearningAgentsInteractor.h |
|
uint64 GetObservationIteration
(
const int32 AgentId |
Gets the observation iteration value for the given agent id. | LearningAgentsInteractor.h | |
const ULearningAgentsObservationObject * GetObservationObject() |
Gets the observation object. | LearningAgentsInteractor.h | |
const TArray< FLearningAgentsObservationObjectElement > & GetObservationObjectElements() |
Gets the observation object elements. | LearningAgentsInteractor.h | |
const ULearningAgentsObservationSchema * GetObservationSchema() |
Gets the observation schema object | LearningAgentsInteractor.h | |
const FLearningAgentsObservationSchemaElement GetObservationSchemaElement() |
Gets the observation schema element | LearningAgentsInteractor.h | |
void GetObservationVector
(
TArray< float >& OutObservationVector, |
Get the current buffered observation vector for the given agent. | LearningAgentsInteractor.h |
|
TLearningArrayView< 2, const float > GetObservationVectorsArrayView() |
Gets the observation vectors as a const array view. | LearningAgentsInteractor.h | |
int32 GetObservationVectorSize() |
Gets the size of the observation vector used by this interactor. | LearningAgentsInteractor.h |
|
bool HasActionModifierVector
(
const int32 AgentId |
Returns true if MakeActionModifiers or SetActionModifierVector has been called and the action modifier vector already set for the given agent. | LearningAgentsInteractor.h |
|
bool HasActionVector
(
const int32 AgentId |
Returns true if DecodeAndSampleActions on the policy or SetActionVector has been called and the action vector already set for the given agent. | LearningAgentsInteractor.h |
|
bool HasObservationVector
(
const int32 AgentId |
Returns true if GatherObservations or SetObservationVector has been called and the observation vector already set for the given agent. | LearningAgentsInteractor.h |
|
void MakeActionModifiers
(
const UE::Learning::FIndexSet AgentSet, |
Make Action Modifiers for a specific set of agents | LearningAgentsInteractor.h | |
void MakeActionModifiers () |
Makes all the action modifiers for all agents. | LearningAgentsInteractor.h |
|
void MakeAgentActionModifier
(
FLearningAgentsActionModifierElement& OutActionModifierElement, |
This callback can be optionally overridden by the Interactor to create an action modifier for a single agent. | LearningAgentsInteractor.h |
|
void MakeAgentActionModifiers
(
TArray< FLearningAgentsActionModifierElement >& OutActionModifierElements, |
This callback can be optionally overridden by the Interactor to create all the action modifier for the given agents. | LearningAgentsInteractor.h |
|
virtual void OnAgentsAdded_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsInteractor.h | ||
virtual void OnAgentsRemoved_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsInteractor.h | ||
virtual void OnAgentsReset_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsInteractor.h | ||
void PerformActions
(
const UE::Learning::FIndexSet AgentSet |
Perform Actions for a specific set of agents | LearningAgentsInteractor.h | |
void PerformActions () |
Performs all the actions for all agents. This will call PerformAgentActions. | LearningAgentsInteractor.h |
|
void PerformAgentAction
(
const ULearningAgentsActionObject* InActionObject, |
This callback should be overridden by the Interactor and performs the action for the given agent in the world. | LearningAgentsInteractor.h |
|
void PerformAgentActions
(
const ULearningAgentsActionObject* InActionObject, |
This callback can be overridden by the Interactor and performs all the actions for the given agents in the world. | LearningAgentsInteractor.h |
|
void SetActionModifierVector
(
const TArray< float >& ActionModifierVector, |
Sets the current buffered action modifier vector for the given agent. | LearningAgentsInteractor.h |
|
void SetActionVector
(
const TArray< float >& ActionVector, |
Sets the current buffered action vector for the given agent. | LearningAgentsInteractor.h |
|
void SetObservationVector
(
const TArray< float >& ObservationVector, |
Sets the current buffered observation vector for the given agent. | LearningAgentsInteractor.h |
|
void SetupInteractor
(
ULearningAgentsManager*& InManager |
Initializes an Interactor. | LearningAgentsInteractor.h |
|
void SpecifyAgentAction
(
FLearningAgentsActionSchemaElement& OutActionSchemaElement, |
-- Actions -- | LearningAgentsInteractor.h |
|
void SpecifyAgentObservation
(
FLearningAgentsObservationSchemaElement& OutObservationSchemaElement, |
-- Observations -- | LearningAgentsInteractor.h |
|
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static ULearningAgentsInteractor * MakeInteractor
(
ULearningAgentsManager*& InManager, |
Constructs an Interactor. | LearningAgentsInteractor.h |
|