WorkerSet.foreach_policy(func: Callable[[ray.rllib.policy.policy.Policy, str], ray.rllib.evaluation.worker_set.T]) List[ray.rllib.evaluation.worker_set.T][source]#

Calls func with each worker’s (policy, PolicyID) tuple.

Note that in the multi-agent case, each worker may have more than one policy.


func – A function - taking a Policy and its ID - that is called on all workers’ Policies.


The list of return values of func over all workers’ policies. The

length of this list is: (num_workers + 1 (local-worker)) * [num policies in the multi-agent config dict]. The local workers’ results are first, followed by all remote workers’ results