unreal.LearningAgentsPolicy
¶
- class unreal.LearningAgentsPolicy(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
LearningAgentsManagerComponent
A policy that maps from observations to actions for the managed agents.
C++ Source:
Plugin: LearningAgents
Module: LearningAgents
File: LearningAgentsPolicy.h
Editor Properties: (see get_editor_property/set_editor_property)
asset_user_data
(Array[AssetUserData]): [Read-Write] Array of user data stored with the componentauto_activate
(bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.can_ever_affect_navigation
(bool): [Read-Write] Whether this component can potentially influence navigationcomponent_tags
(Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.editable_when_inherited
(bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor classhelper_objects
(Array[LearningAgentsHelper]): [Read-Only] The list of current helper objects.interactor
(LearningAgentsInteractor): [Read-Only] The agent interactor this policy is associated with.is_editor_only
(bool): [Read-Write] If true, the component will be excluded from non-editor buildsis_setup
(bool): [Read-Only] True if this component has been setup. Otherwise, false.manager
(LearningAgentsManager): [Read-Only] The associated manager this component is attached to.network
(LearningAgentsNeuralNetwork): [Read-Only] The underlying neural network.on_component_activated
(ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reseton_component_deactivated
(ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivatedprimary_component_tick
(ActorComponentTickFunction): [Read-Write] Main tick function for the Componentreplicate_using_registered_sub_object_list
(bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.replicates
(bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!
- evaluate_policy() None ¶
Calling this function will run the underlying neural network on the previously buffered observations to populate the output action buffer. This should be called after the associated agent interactor’s EncodeObservations and before its DecodeActions.
- load_policy_from_asset(neural_network_asset) None ¶
Load a ULearningAgentsNeuralNetwork asset’s weights into this policy.
- Parameters:
neural_network_asset (LearningAgentsNeuralNetwork) – The asset to load from.
- load_policy_from_snapshot(file) None ¶
Load a snapshot’s weights into this policy.
- Parameters:
file (FilePath) – The snapshot file.
- run_inference() None ¶
Calls EncodeObservations, followed by EvaluatePolicy, followed by DecodeActions
- save_policy_to_asset(neural_network_asset) None ¶
Save this policy’s weights to a ULearningAgentsNeuralNetwork asset.
- Parameters:
neural_network_asset (LearningAgentsNeuralNetwork) – The asset to save to.
- save_policy_to_snapshot(file) None ¶
Save this policy’s weights into a snapshot.
- Parameters:
file (FilePath) – The snapshot file.
- set_action_noise_scale(action_noise_scale) None ¶
Set the action noise scale used.
- Parameters:
action_noise_scale (float) –
- setup_policy(interactor, policy_settings=[], neural_network_asset=None) None ¶
Initializes this object to be used with the given agent interactor and policy settings.
- Parameters:
interactor (LearningAgentsInteractor) – The input Interactor component
policy_settings (LearningAgentsPolicySettings) – The policy settings to use
neural_network_asset (LearningAgentsNeuralNetwork) – Optional Network Asset to use. If provided must match the given PolicySettings. If not provided or asset is empty then a new neural network object will be created according to the given PolicySettings and used.
- use_policy_from_asset(neural_network_asset) None ¶
Use a ULearningAgentsNeuralNetwork asset directly for this critic rather than making a copy. If used during training then this asset’s weights will be updated as training progresses.
- Parameters:
neural_network_asset (LearningAgentsNeuralNetwork) – The asset to use.