Rewards#

protocol enki_env.reward.RewardFunction#

A callable that generates rewards at each step of the environment.

For example

def my_reward(robot: pyenki.DifferentialWheeled, success: bool | None) -> float:
    return -1 if abs(robot.position[0]) > 1 else 0

Classes that implement this protocol must have the following methods / attributes:

__call__(robot: pyenki.DifferentialWheeled, success: bool | None) float#

Generate a reward for a robot.

Parameters:
  • robot – The robot

  • success – Whether the robot has completed the task with success (True) or failure (False), or has yet to complete the task or there is no task (None).

Returns:

The reward assigned to the robot

class enki_env.reward.ConstReward(value: float = -1, success_value: float = 0, failure_value: float = -1)#

Generates a constant reward.

failure_value: float = -1#

the value in case of failure

success_value: float = 0#

the value in case of success

value: float = -1#

the value in case of undecided success/failure