unreal.ConditionalReward

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

Bases: LearningAgentsReward

A simple conditional reward that gives some constant reward value when a condition is true.

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_conditional_reward(agent_trainer, name='None', value=1.000000) ConditionalReward

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

  • value (float) – The amount of reward to give the agent when the provided condition is true.

Returns:

The newly created reward.

Return type:

ConditionalReward

set_conditional_reward(agent_id=-1, condition) None

Sets if the agent should receive a reward. Call during ULearningAgentsTrainer::SetRewards event.

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

  • condition (bool) – If the agent should receive a reward this iteration.