rlmesh.trial_index

functionfrom rlmesh import trial_index[source]

The reserved trial_index reset option, or None when absent.

trial_index(options: Mapping[str, Any] | None) -> int | None

The ordinal of the episode a reset starts, 0-based and walked in order by the runtime (from run(trial_index_base=...), 0 by default), so an env can sweep a fixed list of initial states / goals exactly as its upstream benchmark does instead of re-deriving one from a hashed seed. Delivered only to an env that declared "trial_index" in EnvFactory.reset_options; absent on a hand-driven Session.reset() that passed none::

class MyEnv(rlmesh.EnvFactory): reset_options = (“trial_index”,)

def reset(self, *, seed=None, options=None): trial = rlmesh.trial_index(options) n = len(self.init_states) state = self.init_states[(trial if trial is not None else seed or 0) % n]