- class ray.rllib.policy.policy_map.PolicyMap(*, capacity: int = 100, policy_states_are_swappable: bool = False, worker_index=None, num_workers=None, policy_config=None, session_creator=None, seed=None)[source]#
Maps policy IDs to Policy objects.
Thereby, keeps n policies in memory and - when capacity is reached - writes the least recently used to disk. This allows adding 100s of policies to a Algorithm for league-based setups w/o running out of memory.
PublicAPI (beta): This API is in beta and may change before becoming stable.
__init__(*[, capacity, ...])
Initializes a PolicyMap instance.
Create a new dictionary with keys from iterable and values set to value.
Iterates over all policies, even the stashed ones.
Returns all valid keys, even the stashed ones.
If key is not found, d is returned if given, otherwise KeyError is raised
2-tuple; but raise KeyError if D is empty.
Insert key with a value of default if key is not in the dictionary.
Returns all valid values, even the stashed ones.