TrajectoryGraphUtilityEngine
python
TrajectoryGraphUtilityEngine(configuration: TrajectoryUtilitiesConfiguration | None) -> NoneApplies back-propagated reward/penalty utilities on top of local utility metrics.
Methods
apply
python
apply(recordings: list[TrajectoryRecording], *, default_node_key_fields: list[str] | None) -> Nonecell_reward_support
python
cell_reward_support(utility_key: str, values: dict[str, int], *, default_node_key_fields: list[str] | None) -> intGet how many times a backpropagated utility's reward side has been corroborated for one cell.
Parameters:
utility_key(str) – The backpropagated utility.values(dict[str, int]) – The cell's values.default_node_key_fields(list[str] | None) – Node-key fields used when the utility's graph does not set them.
Returns:
int– The reward-side support count, or0when the utility is not backpropagated.
cell_value
python
cell_value(utility_key: str, values: dict[str, int], *, default_node_key_fields: list[str] | None) -> floatGet a backpropagated utility's net cell value (reward minus penalty) for one cell.
Parameters:
utility_key(str) – The backpropagated utility (for exampleroute_quality).values(dict[str, int]) – The cell's values (start or end values of a recording).default_node_key_fields(list[str] | None) – Node-key fields used when the utility's graph does not set them.
Returns:
float–reward - penaltyfor the cell, or0.0when the utility is not backpropagated.
load_state_dict
python
load_state_dict(state: dict[str, Any] | None) -> Nonelocal_key
python
local_key(metric_key: str) -> strpenalty_key
python
penalty_key(metric_key: str) -> strreward_key
python
reward_key(metric_key: str) -> strsnapshot_cell_values
python
snapshot_cell_values(utility_key: str, field_names: list[str]) -> dict[tuple[int, ...], float]Snapshot a backpropagated utility's net cell value, keyed by the integer tuple of field_names.
Built for lock-free per-step reward shaping: the values change slowly (only as episodes are recorded), so a periodically rebuilt plain-dict snapshot lets the actor read potentials per step without locking the store. Returns an empty dict when the utility is absent or not backpropagated.
Parameters:
utility_key(str) – The backpropagated utility (for examplewin_proximity).field_names(list[str]) – The cell-key fields to extract, in order (the graph node-key fields).
Returns:
dict[tuple[int, ...], float]–{(field values as ints): reward - penalty}for every tracked cell.
state_dict
python
state_dict() -> dict[str, Any]