feat(functional_jax): support reset options for JAX envs#1502
feat(functional_jax): support reset options for JAX envs#1502aryanyk wants to merge 2 commits intoFarama-Foundation:mainfrom
Conversation
|
Hi, the CI workflows are awaiting approval and the PR is ready from my side. |
Instead of a generic, state-mutating implementation in the base class, I recommend that environments requiring dynamic configuration implement a specialized
|
857bb41 to
6d31748
Compare
|
Thanks for the detailed architectural feedback — I agree with the separation-of-concerns point. I’ve refactored the implementation to introduce a dedicated generate_params(**kwargs) hook for reset-time parameter generation. By default this delegates to get_default_params(**kwargs) to preserve backward compatibility and semantic clarity. reset() now calls generate_params() rather than get_default_params() directly. Additionally, I identified a functional gap: although reset options were being accepted, the generated parameters were not consistently threaded through the JAX functional call chain. This has been corrected — params are now explicitly passed through initial, transition, observation, reward, terminal, info, and render. No instance state is mutated; parameters remain explicit function inputs, preserving FuncEnv’s stateless design. Added tests verify: Reset options can change initialization behavior generate_params is invoked during reset Backward compatibility when no options are provided Use case context: this enables reset-time configuration such as stochastic initial state ranges and domain randomization in functional JAX environments, aligning behavior with the broader Gymnasium API. Happy to adjust further if needed. P.S : Due to of push force it is comapring itself with previous PR . Please comapre this PR to latest main |
Description
This PR adds support for
optionsinreset()for functional JAX environments.Currently,FunctionalJaxEnvandFunctionalJaxVectorEnvaccept anoptionsargument inreset()but ignore it. This makes reset-time configurationinconsistent with the Gymnasium API.
This change wires reset options into
FuncEnv.get_default_params, enablingenvironment-specific parameter overrides on reset.
Changes
FuncEnv.get_default_params(**options)during resetoptionsis not providedFixes #1138
Type of change
Please delete options that are not relevant.
Checklist:
pre-commitchecks withpre-commit run --all-files(seeCONTRIBUTING.mdinstructions to set it up)