Argmax

class rlforge.utils.argmax(values)

Return the index of the maximum value in an array, with random tie-breaking.

Unlike the standard numpy.argmax, this function resolves ties by randomly selecting among all indices that share the maximum value. This ensures that when multiple actions have equal value estimates, exploration is preserved.

Parameters

valuesnumpy.ndarray, shape (n_actions,)

1-D array of values (e.g., action-value estimates).

Returns

indexint

Index of one of the maximum values, chosen uniformly at random if there are multiple maxima.