qgym.templates.rewarder module

Generic abstract base class for a RL rewarder.

All rewarders should inherit from Rewarder.

class qgym.templates.rewarder.Rewarder[source]

Bases: object

RL Rewarder, for computing rewards on a state.

__eq__(other)[source]

Checks whether an object ‘other’ is equal to self.

This check is performed by checking of the self and other are of exactly the same type. Afterwards, all slots (if any) are equal and if all attributes are equal.

Return type:

bool

Returns:

Boolean stating wether other is equal to self.

abstract compute_reward(*, old_state, action, new_state)[source]

Compute a reward, based on the old state, new state, and the given action.

Parameters:
  • old_state (Any) – State of the Environment before the current action.

  • action (Any) – Action that has just been taken.

  • new_state (Any) – Updated state of the Environment.

Return type:

float

Returns:

The reward for this action.

property reward_range: tuple[float, float]

Reward range of the rewarder. I.e., range that rewards can lie in.