class_docstr: Event aggregation object for reward customization and shaping.
class_docstr_tok: ["Event","aggregation","object","for","reward","customization","and","shaping","."]
docstr: Summarize the reward for this step. Expected to be called once per structured step.
  
  Calculates the reward based either on the current maze state of the environment
  (provided as an argument), or by querying the events dispatched by the environment
  during the last step. The former is simpler, the latter is more flexible, as
  environment state does not always carry all the necessary information on what took place in the last step.
  
  In most scenarios, the reward is returned either as a scalar, or as an numpy array corresponding
  to the number of actors that acted in the last step. Scalar is useful in scenarios with single actor
  only, or when per-actor reward cannot be easily attributed and a shared scalar reward makes more sense.
  An array is useful in scenarios where per-actor reward makes sense, such as in multi-agent setting.
  
  :param maze_state: Current state of the environment.
  :return: Reward for the last structured step. In most cases, either a scalar or an array with an item
           for each actor active during the last step.
docstr_tok: ["Summarize","the","reward","for","this","step",".","Expected","to","be","called","once","per","structured","step",".","Calculates","the","reward","based","either","on","the","current","maze","state","of","the","environment","(","provided","as","an","argument",")",",","or","by","querying","the","events","dispatched","by","the","environment","during","the","last","step",".","The","former","is","simpler",",","the","latter","is","more","flexible",",","as","environment","state","does","not","always","carry","all","the","necessary","information","on","what","took","place","in","the","last","step",".","In","most","scenarios",",","the","reward","is","returned","either","as","a","scalar",",","or","as","an","numpy","array","corresponding","to","the","number","of","actors","that","acted","in","the","last","step",".","Scalar","is","useful","in","scenarios","with","single","actor","only",",","or","when","per-actor","reward","can","not","be","easily","attributed","and","a","shared","scalar","reward","makes","more","sense",".","An","array","is","useful","in","scenarios","where","per-actor","reward","makes","sense",",","such","as","in","multi-agent","setting",".",":","param","maze_state",":","Current","state","of","the","environment",".",":","return",":","Reward","for","the","last","structured","step",".","In","most","cases",",","either","a","scalar","or","an","array","with","an","item","for","each","actor","active","during","the","last","step","."]
code: def summarize_reward(
      self, maze_state: Optional[MazeStateType] = None
  ) -> Union[float, np.ndarray]:
      """
      Summarize the reward for this step. Expected to be called once per structured step.
  
      Calculates the reward based either on the current maze state of the environment
      (provided as an argument), or by querying the events dispatched by the environment
      during the last step. The former is simpler, the latter is more flexible, as
      environment state does not always carry all the necessary information on what took place in the last step.
  
      In most scenarios, the reward is returned either as a scalar, or as an numpy array corresponding
      to the number of actors that acted in the last step. Scalar is useful in scenarios with single actor
      only, or when per-actor reward cannot be easily attributed and a shared scalar reward makes more sense.
      An array is useful in scenarios where per-actor reward makes sense, such as in multi-agent setting.
  
      :param maze_state: Current state of the environment.
      :return: Reward for the last structured step. In most cases, either a scalar or an array with an item
               for each actor active during the last step.
      """
  
file_path: maze/maze/core/env/reward.py
imports: from abc import abstractmethod, ABC
  from typing import Union, List, Type, Optional
  import numpy
  from maze.core.annotations import override
  from maze.core.env.maze_state import MazeStateType
  from maze.core.events.pubsub import Subscriber
label_desc: Use image node_id 1 for calling the RewardAggregatorInterface obj's underlying member method code with example usage: obj.summarize_reward(maze_state) without return types