Navigation
API > API/Plugins > API/Plugins/LearningAgents
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- ULearningAgentsManagerListener
- ULearningAgentsInteractor
References
| Module | LearningAgents |
| Header | /Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Public/LearningAgentsInteractor.h |
| Include | #include "LearningAgentsInteractor.h" |
Syntax
UCLASS (Abstract, HideDropDown, BlueprintType, Blueprintable)
class ULearningAgentsInteractor : public ULearningAgentsManagerListener
Remarks
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.
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 | GatherAgentObservation
(
FLearningAgentsObservationObjectElement& OutObservationObjectElement, |
This callback should be overridden by the Interactor and gathers the observations for a single agent. | |
| void | GatherAgentObservations
(
TArray< FLearningAgentsObservationObjectElement >& OutObservationObjectElements, |
This callback can be overridden by the Interactor and gathers all the observations for the given agents. | |
| void | GatherObservations
(
const UE::Learning::FIndexSet AgentSet, |
-- Non-blueprint public interface -- | |
| void | -- Blueprint public interface -- | ||
| int32 | Gets the size of the action distribution vector used by this interactor. | ||
| int32 | Gets the size of the encoded action vector used by this interactor. | ||
| uint64 | GetActionIteration
(
const int32 AgentId |
Gets the action iteration value for the given agent id. | |
| ULearningAgentsActionObject * | Gets the action object. | ||
| TArray< FLearningAgentsActionObjectElement > & | Gets the action object elements. | ||
| const ULearningAgentsActionSchema * | Gets the action schema object | ||
| const FLearningAgentsActionSchemaElement | Gets the action schema element | ||
| void | GetActionVector
(
TArray< float >& OutActionVector, |
Get the current buffered action vector for the given agent. | |
| TLearningArrayView< 2, const float > | Gets the action vectors as a const array view. | ||
| TLearningArrayView< 1, uint64 > | Gets the action vector iterations as a mutable array view. | ||
| TLearningArrayView< 2, float > | Gets the action vectors as a mutable array view. | ||
| int32 | Gets the size of the action vector used by this interactor. | ||
| int32 | Gets the size of the encoded observation vector used by this interactor. | ||
| uint64 | GetObservationIteration
(
const int32 AgentId |
Gets the observation iteration value for the given agent id. | |
| const ULearningAgentsObservationObject * | Gets the observation object. | ||
| const TArray< FLearningAgentsObservationObjectElement > & | Gets the observation object elements. | ||
| const ULearningAgentsObservationSchema * | Gets the observation schema object | ||
| const FLearningAgentsObservationSchemaElement | Gets the observation schema element | ||
| void | GetObservationVector
(
TArray< float >& OutObservationVector, |
Get the current buffered observation vector for the given agent. | |
| TLearningArrayView< 2, const float > | Gets the observation vectors as a const array view. | ||
| int32 | Gets the size of the observation vector used by this interactor. | ||
| 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. | |
| bool | HasObservationVector
(
const int32 AgentId |
Returns true if GatherObservations or SetObservationVector has been called and the observation vector already set for the given agent. | |
| ULearningAgentsInteractor * | MakeInteractor
(
ULearningAgentsManager*& InManager, |
Constructs an Interactor. | |
| void | OnAgentsAdded_Implementation
(
const TArray< int32 >& AgentIds |
||
| void | OnAgentsRemoved_Implementation
(
const TArray< int32 >& AgentIds |
||
| void | OnAgentsReset_Implementation
(
const TArray< int32 >& AgentIds |
||
| void | PerformActions
(
const UE::Learning::FIndexSet AgentSet |
Perform Actions for a specific set of agents | |
| void | Performs all the actions for all agents. This will call PerformAgentActions. | ||
| void | PerformAgentAction
(
const ULearningAgentsActionObject* InActionObject, |
This callback should be overridden by the Interactor and performs the action for the given agent in the world. | |
| 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. | |
| void | SetActionVector
(
const TArray< float >& ActionVector, |
Sets the current buffered action vector for the given agent. | |
| void | SetObservationVector
(
const TArray< float >& ObservationVector, |
Sets the current buffered observation vector for the given agent. | |
| void | SetupInteractor
(
ULearningAgentsManager*& InManager |
Initializes an Interactor. | |
| void | SpecifyAgentAction
(
FLearningAgentsActionSchemaElement& OutActionSchemaElement, |
-- Actions -- | |
| void | SpecifyAgentObservation
(
FLearningAgentsObservationSchemaElement& OutObservationSchemaElement, |
-- Observations -- |