cage-challenge / CybORG

Cyber Operations Research Gym
Other
59 stars 26 forks source link

Support for other `gym` versions #10

Open rademacher-p opened 1 year ago

rademacher-p commented 1 year ago

This package requires gym==0.23.1, influencing which third-party RL libraries are compatible.

Is there potential support for the latest gym version v0.26, or even better, the new gymnasium package that is replacing Gym?

Also, the gym API for v0.23 is not too dissimilar from the v0.21 API. Can this be supported? Pre-v0.22 gym is still commonplace and is required for the popular Stable Baselines 3.

Thanks for the info!

maxstanden commented 1 year ago

That versioning requirement is for np_random imported from gym.utils.seeding and the use of its randint function. If there is a version of this function that supports more libraries then we would be happy to change to it.

rademacher-p commented 1 year ago

As far as I can tell, the only difference in seeding behavior between the latest version of gymnasium and gym==0.23.1 is the definition of seeding.RandomNumberGenerator. Note that the source code for the latter marks that their RNG is deprecated in favor of the newer NumPy Generator objects.

Similarly, a variety of methods, randint included, are deprecated. In v0.23.1, these methods were simply wrapping the new Generator methods; the source code indicates the proper replacements for the modern API.

If the problem is that other CybORG code is accessing env.np_random.randint, these instances could most likely be replaced with env.np_random.integers without raising any errors. I'm just onboarding with CybORG, but would be happy to help with a PR 😃

Note that there would be other considerations before gymnasium would be compatible, specifically the updates to the environment step and reset API