unreal.PositionArraySimilarityReward

class unreal.PositionArraySimilarityReward(outer: Object | None = None, name: Name | str = 'None')

Bases: LearningAgentsReward

A reward for minimizing the distances of positions in the given arrays.

C++ Source:

  • Plugin: LearningAgents

  • Module: LearningAgentsTraining

  • File: LearningAgentsRewards.h

Editor Properties: (see get_editor_property/set_editor_property)

  • agent_trainer (LearningAgentsTrainer): [Read-Only] Reference to the Trainer this reward is associated with.

classmethod add_position_array_similarity_reward(agent_trainer, name='None', position_num=0, scale=100.000000, weight=1.000000) PositionArraySimilarityReward

Adds a new position array similarity reward to the given trainer. Call during ULearningAgentsTrainer::SetupRewards event.

Parameters:
  • agent_trainer (LearningAgentsTrainer) – The trainer to add this reward to.

  • name (Name) – The name of this new reward. Used for debugging.

  • position_num (int32) – The number of positions in the array.

  • scale (float) – Used to normalize the data for the reward.

  • weight (float) – Multiplier for this reward when being summed up for the total reward.

Returns:

The newly created reward.

Return type:

PositionArraySimilarityReward

set_position_array_similarity_reward(agent_id=-1, positions0, positions1, relative_position0=[0.000000, 0.000000, 0.000000], relative_position1=[0.000000, 0.000000, 0.000000], relative_rotation0=[0.000000, 0.000000, 0.000000], relative_rotation1=[0.000000, 0.000000, 0.000000]) None

Sets the data for this reward. Call during ULearningAgentsTrainer::SetRewards event.

Parameters:
  • agent_id (int32) – The agent id this data corresponds to.

  • positions0 (Array[Vector]) – The current positions.

  • positions1 (Array[Vector]) – The goal positions.

  • relative_position0 (Vector) – The vector Positions0 will be offset from.

  • relative_position1 (Vector) – The vector Positions1 will be offset from.

  • relative_rotation0 (Rotator) – The frame of reference rotation for Positions0.

  • relative_rotation1 (Rotator) – The frame of reference rotation for Positions1.