Navigation
API > API/Plugins > API/Plugins/LearningAgents
A policy that maps from observations to actions.
| Name | ULearningAgentsPolicy |
| Type | class |
| Header File | /Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Public/LearningAgentsPolicy.h |
| Include Path | #include "LearningAgentsPolicy.h" |
Syntax
UCLASS (MinimalAPI, BlueprintType, Blueprintable, Meta=(BlueprintSpawnableComponent))
class ULearningAgentsPolicy : public ULearningAgentsManagerListener
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → ULearningAgentsManagerListener → ULearningAgentsPolicy
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| These constructors/destructors are needed to make forward declarations happy. | LearningAgentsPolicy.h | ||
ULearningAgentsPolicy
(
FVTableHelper& Helper |
LearningAgentsPolicy.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ULearningAgentsPolicy() |
LearningAgentsPolicy.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ActionDistributionVectors | TLearningArray< 2, float > | Action distribution vector buffers | LearningAgentsPolicy.h | |
| ActionVectorEncodedIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times encoded action vector has been set for all agents | LearningAgentsPolicy.h | |
| ActionVectorsEncoded | TLearningArray< 2, float > | Encoded action vector buffers | LearningAgentsPolicy.h | |
| DecoderNetwork | TObjectPtr< ULearningAgentsNeuralNetwork > | The underlying decoder neural network. | LearningAgentsPolicy.h |
|
| DecoderObject | TSharedPtr< UE::Learning::FNeuralNetworkFunction > | Internal Decoder Function Object | LearningAgentsPolicy.h | |
| EncoderNetwork | TObjectPtr< ULearningAgentsNeuralNetwork > | The underlying encoder neural network. | LearningAgentsPolicy.h |
|
| EncoderObject | TSharedPtr< UE::Learning::FNeuralNetworkFunction > | Internal Encoder Function Object | LearningAgentsPolicy.h | |
| GlobalSeed | uint32 | The global random seed state used to initialize network weights and during sampling | LearningAgentsPolicy.h | |
| Interactor | TObjectPtr< ULearningAgentsInteractor > | --Private Data -- | LearningAgentsPolicy.h |
|
| MemoryState | TLearningArray< 2, float > | The internal memory state of each agent. | LearningAgentsPolicy.h | |
| MemoryStateIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times the memory state has been updated for all agents. | LearningAgentsPolicy.h | |
| ObservationVectorEncodedIteration | TLearningArray< 1, uint64, TInlineAllocator< 32 > > | Number of times encoded observation vector has been set for all agents | LearningAgentsPolicy.h | |
| ObservationVectorsEncoded | TLearningArray< 2, float > | Encoded observation vector buffers | LearningAgentsPolicy.h | |
| PolicyNetwork | TObjectPtr< ULearningAgentsNeuralNetwork > | The underlying policy neural network. | LearningAgentsPolicy.h |
|
| PolicyObject | TSharedPtr< UE::Learning::FNeuralNetworkPolicy > | Internal Policy Function Object | LearningAgentsPolicy.h | |
| PolicySettings | FLearningAgentsPolicySettings | LearningAgentsPolicy.h | ||
| PreEvaluationMemoryState | TLearningArray< 2, float > | The internal memory state of each agent before evaluation. | LearningAgentsPolicy.h | |
| Seeds | TLearningArray< 1, uint32 > | The individual per-agent seeds used during sampling of actions. | LearningAgentsPolicy.h | |
| ValidAgentIds | TArray< int32 > | Temp buffers used to record the set of agents that are valid for evaluation | LearningAgentsPolicy.h | |
| ValidAgentSet | UE::Learning::FIndexSet | LearningAgentsPolicy.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TSharedRef< FJsonObject > AsJsonConfig() |
LearningAgentsPolicy.h | ||
void DecodeAndSampleActions
(
const float ActionNoiseScale |
Decodes and samples action vectors using the Decoder network. | LearningAgentsPolicy.h |
|
void EncodeObservations () |
-- Blueprint public interface -- | LearningAgentsPolicy.h |
|
void EvaluatePolicy () |
Calling this function will run the underlying neural network on the previously encoded observations to populate the encoded actions. | LearningAgentsPolicy.h |
|
ULearningAgentsNeuralNetwork * GetDecoderNetworkAsset() |
Gets the current Encoder Network Asset being used | LearningAgentsPolicy.h |
|
UE::Learning::FNeuralNetworkFunction & GetDecoderObject() |
Get a reference to this policy's decoder function object. | LearningAgentsPolicy.h | |
ULearningAgentsNeuralNetwork * GetEncoderNetworkAsset() |
Gets the current Encoder Network Asset being used | LearningAgentsPolicy.h |
|
| -- Non-blueprint public interface -- | LearningAgentsPolicy.h | ||
void GetMemoryState
(
TArray< float >& OutMemoryState, |
Gets the current memory state for a given agent as represented by an abstract vector learned by the policy. | LearningAgentsPolicy.h |
|
TLearningArrayView< 2, const float > GetMemoryState () |
Get a const view to this policy's memory state. | LearningAgentsPolicy.h | |
int32 GetMemoryStateSize() |
Gets the size of the memory state | LearningAgentsPolicy.h |
|
TLearningArrayView< 2, const float > GetObservationVectorsEncoded() |
Get a const view to this policy's encoded observation vectors. | LearningAgentsPolicy.h | |
ULearningAgentsNeuralNetwork * GetPolicyNetworkAsset() |
Gets the current Policy Network Asset being used | LearningAgentsPolicy.h |
|
UE::Learning::FNeuralNetworkPolicy & GetPolicyObject() |
Get a reference to this policy's policy function object. | LearningAgentsPolicy.h | |
TLearningArrayView< 2, const float > GetPreEvaluationMemoryState() |
Get a const view to this policy's pre-evaluation memory state. | LearningAgentsPolicy.h | |
bool HasEncodedObservationsForAgent
(
const int32 AgentId |
Returns true if this policy has encoded observations for the given agent id. Otherwise, false. | LearningAgentsPolicy.h | |
virtual void OnAgentsAdded_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsPolicy.h | ||
virtual void OnAgentsRemoved_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsPolicy.h | ||
virtual void OnAgentsReset_Implementation
(
const TArray< int32 >& AgentIds |
LearningAgentsPolicy.h | ||
void RunInference
(
const float ActionNoiseScale |
Calls GatherObservations, EncodeObservations, EvaluatePolicy, DecodeAndSampleActions, PerformActions | LearningAgentsPolicy.h |
|
void SetMemoryState
(
const int32 AgentId, |
Sets the current memory state for a given agent as represented by an abstract vector learned by the policy. | LearningAgentsPolicy.h |
|
void SetupPolicy
(
ULearningAgentsManager*& InManager, |
Initializes this object to be used with the given agent interactor and policy settings. | LearningAgentsPolicy.h |
|
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static ULearningAgentsPolicy * MakePolicy
(
ULearningAgentsManager*& InManager, |
Constructs this object to be used with the given agent interactor and policy settings. | LearningAgentsPolicy.h |
|