smartgrid.agents.agent.Agent

class smartgrid.agents.agent.Agent(name: str, profile: AgentProfile)[source]

Bases: object

An agent represents a physical entity in the world.

It contains:
  • a (unique) name for identifying the agent;

  • a (current) state;

  • an intended action for a step, what the Agent wanted to do;

  • an enacted action for a step, what the Agent really did;

  • an agent profile, the common characteristics shared by multiple agents.

__init__(name: str, profile: AgentProfile)[source]

Methods

__init__(name, profile)

decrease_storage(amount)

Function for adding some energy in the storage.

handle_action()

Perform the intended action and transform it into the enacted action.

increase_storage(amount)

Function for adding some energy in the storage.

reset()

update(step)

Update the agent's current state (production, need, storage, comfort).

Attributes

comfort

need

payoff_range

payoff_ratio

Return the current payoff scaled to [0,1].

production

storage_ratio

Return the current storage quantity over its capacity (in [0,1]).

name

state

intended_action

enacted_action

profile

decrease_storage(amount: float) -> (<class 'float'>, <class 'float'>, <class 'float'>)[source]

Function for adding some energy in the storage.

Parameters:

amount – energy for charging the battery.

Returns:

a tuple of float with the quantity in the battery, the energy took and the energy that was missing.

handle_action() Action[source]

Perform the intended action and transform it into the enacted action.

The intended action represents the action the agent intends to do, if possible, but it may happen that, due to some constraint, e.g., battery capacity, it is not possible as-is. This method thus transforms the intended action into an enacted action, taking into account these constraints, and updates the Agent’s state according to the enacted action.

Returns:

The enacted action that truly happened, after the Agent’s state was updated.

increase_storage(amount: float) -> (<class 'float'>, <class 'float'>, <class 'float'>)[source]

Function for adding some energy in the storage.

Parameters:

amount – energy for charging the battery.

Returns:

a tuple of float with the quantity in the battery, the energy added and the energy that cannot be stocked.

property payoff_ratio: float

Return the current payoff scaled to [0,1].

property storage_ratio: float

Return the current storage quantity over its capacity (in [0,1]).

update(step: int) None[source]

Update the agent’s current state (production, need, storage, comfort).

Parameters:

step – The current time step.