smartgrid.rewards.numeric.differentiated.adaptability.AdaptabilityTwo

class smartgrid.rewards.numeric.differentiated.adaptability.AdaptabilityTwo[source]

Bases: Reward

Equity when t<2000, (Equity+OverConsumption)/2 otherwise.

This reward function changes its definition after time step t=2000. With t < 2000, it performs exactly as the Equity reward function. When t >= 2000, it returns the average of Equity and the OverConsumption reward functions.

Thus, the targeted objectives increase in the second phase: the initial one is kept, and a new one is added (equity vs equity+overconsumption). This makes this reward function useful to evaluate whether agents are able to change their behaviour by taking into account new objectives in addition to previous ones.

This reward function is easier than AdaptabilityOne (which completely replace the set of objectives) and AdaptabilityThree (which uses 3 phases instead of 2).

__init__()[source]

Methods

__init__()

calculate(world, agent)

Compute the reward for a specific Agent at the current time step.

reset()

Reset the reward function.

Attributes

name

Uniquely identifying, human-readable name for this reward function.

calculate(world, agent)[source]

Compute the reward for a specific Agent at the current time step.

Parameters:
  • world – The World, used to get the current state and determine consequences of the agent’s action.

  • agent – The Agent that is rewarded, used to access particular information about the agent (personal state) and its action.

Returns:

A reward, i.e., a single value describing how well the agent performed. The higher the reward, the better its action was. Typically, a value in [0,1] but any range can be used.

name: str

Uniquely identifying, human-readable name for this reward function.

reset()

Reset the reward function.

This function must be overridden by reward functions that use a state, so that the state is reset with the environment. By default, does nothing, as most reward functions do not use a state.