unreal.LearningAgentsRewards
¶
- class unreal.LearningAgentsRewards(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
BlueprintFunctionLibrary
Learning Agents Rewards
C++ Source:
Plugin: LearningAgents
Module: LearningAgentsTraining
File: LearningAgentsRewards.h
- classmethod make_reward(reward_value, reward_scale=1.000000, tag='Reward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward from a float value.
- Parameters:
reward_value (float) – The float value used to create the reward.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_angle_similarity(angle_a, angle_b, reward_scale=1.000000, tag='AngleSimilarityReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_angle_location_a=[0.000000, 0.000000, 0.000000], visual_logger_angle_location_b=[0.000000, 0.000000, 0.000000], visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on how similar two angles are. Angles should be given in degrees.
- Parameters:
angle_a (float) – The first angle.
angle_b (float) – The second angle.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_angle_location_a (Vector) – A location for the visual logger to display the first angle in the world.
visual_logger_angle_location_b (Vector) – A location for the visual logger to display the second angle in the world.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_direction_similarity(direction_a=[1.000000, 0.000000, 0.000000], direction_b=[1.000000, 0.000000, 0.000000], reward_scale=1.000000, tag='DirectionSimilarityReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_direction_location_a=[0.000000, 0.000000, 0.000000], visual_logger_direction_location_b=[0.000000, 0.000000, 0.000000], visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_arrow_length=100.000000, visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on how similar two directions are.
- Parameters:
direction_a (Vector) – The first direction.
direction_b (Vector) – The second direction.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_direction_location_a (Vector) – A location for the visual logger to display the first direction in the world.
visual_logger_direction_location_b (Vector) – A location for the visual logger to display the second direction in the world.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_arrow_length (float) – The length of the arrow to display for the directions.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_location_similarity(location_a, location_b, location_scale=100.000000, reward_scale=1.000000, tag='LocationSimilarityReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on how similar two locations are.
- Parameters:
location_a (Vector) – The first location.
location_b (Vector) – The second location.
location_scale (float) – The expected scale for the distance between locations.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_rotation_similarity(rotation_a, rotation_b, reward_scale=1.000000, tag='RotationSimilarityReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_rotation_location_a=[0.000000, 0.000000, 0.000000], visual_logger_rotation_location_b=[0.000000, 0.000000, 0.000000], visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on how similar two rotations are.
- Parameters:
rotation_a (Rotator) – The first rotation.
rotation_b (Rotator) – The second rotation.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_rotation_location_a (Vector) – A location for the visual logger to display the first rotation in the world.
visual_logger_rotation_location_b (Vector) – A location for the visual logger to display the second rotation in the world.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_rotation_similarity_as_quats(rotation_a, rotation_b, reward_scale=1.000000, tag='RotationSimilarityReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_rotation_location_a=[0.000000, 0.000000, 0.000000], visual_logger_rotation_location_b=[0.000000, 0.000000, 0.000000], visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on how similar two rotations are represented as quaternions.
- Parameters:
rotation_a (Quat) – The first rotation.
rotation_b (Quat) – The second rotation.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_rotation_location_a (Vector) – A location for the visual logger to display the first rotation in the world.
visual_logger_rotation_location_b (Vector) – A location for the visual logger to display the second rotation in the world.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_from_velocity_along_spline(spline_component, location, velocity, velocity_scale=200.000000, reward_scale=1.000000, finite_difference_delta=10.000000, tag='VelocityAlongSplineReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward based on the velocity an object is moving along a spline.
- Parameters:
spline_component (SplineComponent) – The spline.
location (Vector) – The location of the object.
velocity (Vector) – The velocity of the object.
velocity_scale (float) – The expected scale for the velocity.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
finite_difference_delta (float) – The finite difference to use when computing the velocity along the spline.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_on_condition(condition, reward_scale=1.000000, tag='ConditionReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward which is equal to RewardScale when bCondition is true, otherwise returns zero.
- Parameters:
condition (bool) – The condition under which to create a reward.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_on_location_difference_above_threshold(location_a, location_b, distance_threshold=100.000000, reward_scale=1.000000, tag='LocationDifferenceAboveThresholdReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward when the distance between two locations is above a threshold, otherwise returns zero.
- Parameters:
location_a (Vector) – The first location.
location_b (Vector) – The second location.
distance_threshold (float) – The distance threshold.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type:
- classmethod make_reward_on_location_difference_below_threshold(location_a, location_b, distance_threshold=100.000000, reward_scale=1.000000, tag='LocationDifferenceBelowThresholdReward', visual_logger_enabled=False, visual_logger_listener=None, visual_logger_agent_id=-1, visual_logger_location=[0.000000, 0.000000, 0.000000], visual_logger_color=[0.000000, 1.000000, 0.000000, 1.000000]) float ¶
Make a reward when the distance between two locations is below a threshold, otherwise returns zero.
- Parameters:
location_a (Vector) – The first location.
location_b (Vector) – The second location.
distance_threshold (float) – The distance threshold.
reward_scale (float) – The scale of the reward. Use a negative scale to create a penalty.
tag (Name) – The tag for the reward. Used for debugging.
visual_logger_enabled (bool) – When true, debug data will be sent to the visual logger.
visual_logger_listener (LearningAgentsManagerListener) – The listener object which is making this reward. This must be set to use logging.
visual_logger_agent_id (int32) – The agent id associated with this reward.
visual_logger_location (Vector) – A location for the visual logger information in the world.
visual_logger_color (LinearColor) – The color for the visual logger display.
- Returns:
The resulting reward value.
- Return type: