unreal.FloatReward

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

Bases: LearningAgentsReward

A simple float reward. Used as a catch-all for situations where a more type-specific reward does not exist yet.

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_float_reward(agent_trainer, name='None', weight=1.000000) FloatReward

Adds a new float 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.

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

Returns:

The newly created reward.

Return type:

FloatReward

set_float_reward(agent_id=-1, reward) None

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

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

  • reward (float) – The value currently being rewarded.