smartgrid.observation.observation_manager.ObservationManager¶
- class smartgrid.observation.observation_manager.ObservationManager(local_observation: ~typing.Type[~smartgrid.observation.local_observation.LocalObservation] = <class 'smartgrid.observation.local_observation.LocalObservation'>, global_observation: ~typing.Type[~smartgrid.observation.global_observation.GlobalObservation] = <class 'smartgrid.observation.global_observation.GlobalObservation'>, observation: ~typing.Type[~smartgrid.observation.observations.Observation] = <class 'smartgrid.observation.observations.Observation'>)[source]¶
- Bases: - object- The ObservationManager is responsible for computing observations. - Its primary purpose is to allow extensibility: the attributes - global_observationand- local_observation, which are set through the constructor, control which Observation classes will be used in the simulator. It is thus possible to subclass- GlobalObservationand/or- LocalObservationto use different observations.- The computing calls ( - compute_agent()and- compute_global()) are delegated to the corresponding calls through these attributes.- __init__(local_observation: ~typing.Type[~smartgrid.observation.local_observation.LocalObservation] = <class 'smartgrid.observation.local_observation.LocalObservation'>, global_observation: ~typing.Type[~smartgrid.observation.global_observation.GlobalObservation] = <class 'smartgrid.observation.global_observation.GlobalObservation'>, observation: ~typing.Type[~smartgrid.observation.observations.Observation] = <class 'smartgrid.observation.observations.Observation'>)[source]¶
 - Methods - __init__([local_observation, ...])- compute_agent(world, agent)- Create the local observation for an Agent. - compute_global(world)- Create the global observation for the World. - reset()- Reset the ObservationManager. - Attributes - Describe the shapes of the various Observations (local, global, merged). - The class that will be used to compute global observations. - The class that will be used to compute local observations. - The class that will be used as the "complete" observation. - compute_agent(world: World, agent: Agent) LocalObservation[source]¶
- Create the local observation for an Agent. 
 - compute_global(world) GlobalObservation[source]¶
- Create the global observation for the World. 
 - global_observation: Type[GlobalObservation]¶
- The class that will be used to compute global observations. It should be a subclass of - GlobalObservationto ensure that necessary methods are present. Please note that this field should be set to a class itself, not an instance, e.g.,- GlobalObservation(instead of- GlobalObservation()).
 - local_observation: Type[LocalObservation]¶
- The class that will be used to compute local observations. It should be a subclass of - LocalObservationto ensure that necessary methods are present. Please note that this field should be set to a class itself, not an instance, e.g.,- LocalObservation(instead of- LocalObservation()).
 - observation: Type[Observation]¶
- The class that will be used as the “complete” observation. 
 - reset()[source]¶
- Reset the ObservationManager. - It is particularly important to reset the memoization process of - GlobalObservation.
 - property shape: Dict[str, int]¶
- Describe the shapes of the various Observations (local, global, merged). - Return type:
- Returns:
- A dict comprised of: - agent_state,- local_state, and- global_state. Each of these fields describe the shape (i.e., number of dimensions) of the corresponding observation. Note that- agent_staterefers to the merged (both local and global) case.