ethicalgardeners.observation.TotalObservation¶
- class ethicalgardeners.observation.TotalObservation(grid_world)[source]¶
Bases:
ObservationStrategyStrategy that provides agents with a complete view of the entire grid.
This strategy gives agents perfect information about the state of the environment, including all cells, agents, and flowers.
Each cell in the grid is represented as a vector of features:
Cell type (normalized): Value between 0 and 1 representing the type of cell (
CellType) divided by the number of cell types.Pollution level (normalized): Value between 0 and 1 representing the pollution level in the cell, normalized between the minimum and maximum pollution levels in the grid.
Flower presence and type (normalized): 0 if no flower is present, otherwise a value between 0 and 1 representing the flower type + 1 divided by the number of flower types.
Flower growth stage (normalized): 0 if no flower is present, otherwise a value between 0 and 1 representing the current growth stage of the flower + 1 divided by the total number of growth stages + 1.
Agent presence (normalized): 0 if no agent is present, otherwise a value between 0 and 1 representing the index of the agent in the grid world + 1 divided by the total number of agents.
Agent’s X position (normalized): Value between 0 and 1 representing the agent’s X position normalized by the grid width minus 1.
Agent’s Y position (normalized): Value between 0 and 1 representing the agent’s Y position normalized by the grid height minus 1.
- observation_shape¶
The dimensions of the observation (width, height, FEATURES_PER_CELL).
- Type:
- __init__(grid_world)[source]¶
Create the total observation strategy.
- Parameters:
grid_world (
GridWorld) – The grid world environment to observe.
Methods
__init__(grid_world)Create the total observation strategy.
get_observation(grid_world, agent)Generate a complete observation of the entire grid.
observation_space(agent)Define the observation space as a Box with the full grid and features per cell.
- get_observation(grid_world, agent: Agent)[source]¶
Generate a complete observation of the entire grid.
- Parameters:
- Returns:
A 3D array containing the full grid state.
- Return type: