Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save / restore environment (wishlist) #79

Closed
hagrid67 opened this issue Sep 27, 2017 · 4 comments
Closed

Save / restore environment (wishlist) #79

hagrid67 opened this issue Sep 27, 2017 · 4 comments

Comments

@hagrid67
Copy link

hagrid67 commented Sep 27, 2017

Would it be possible to provide functionality to save and restore a running environment? Ie read the complete state of the environment, all the bone/object locations and orientations, velocities and angular velocities, and any state associated with the muscles, and then recreate (or reset) another environment to the same state.

This means more than just starting two environments with the same seed - it means copying an environment which has already evolved over lots of steps and actions.

It should be possible to copy the env to another machine (ie OS instance).

This would be to support the "vine" method in Section 5.2 in the 2017 Schulman TRPO paper which uses a "short rollout", in order to test the effect of several different actions from a given state.

I suggest It's probably not necessary to "read" the contents of the serialised state, in case it's easier or desirable to make it opaque. The main requirement is essentially to clone a running environment. However it would be better to do this by providing the serialised state, so "we" users/programmers/competitors can manage the copy. (ie it wouldn't be so helpful if there was simply a clone() call returning a handle to a new env running on the same machine, as we wouldn't then be able to manage the load-balancing)

@hagrid67
Copy link
Author

See this similar issue for OpenAI - openai/gym#402

Here is the relevant diagram from Schulman 2017 TRPO (CRN means common random numbers):
image

kidzik added a commit that referenced this issue Oct 1, 2017
@kidzik
Copy link
Member

kidzik commented Oct 1, 2017

These are all very good points, thanks for sharing. Rollback is possible in the current environment. I made an experimental example here https://github.com/stanfordnmbl/osim-rl/blob/rollback/tests/test.rollback.py . Saving to a file and restoring is, unfortunately, tricky and we won't be able to support it.

Since the environment is deterministic, for a quick hack, one can record trajectories of actions, which led to a certain point. For generating the same obstacles and muscles parameters, it's enough to use the same seed and difficulty.

@hagrid67
Copy link
Author

hagrid67 commented Oct 2, 2017

Thanks Łukasz, I think your example should be enough to allow us to implement "consecutive" branching, if not parallel. It means we don't need to replay actions to get back to the same point, so we can get the environment to try out some different actions / rollouts, without significant computational overhead - just a bit of inflexibility around the timing. If I'm understanding correctly :)

kidzik added a commit that referenced this issue Dec 21, 2017
@kidzik
Copy link
Member

kidzik commented Jun 29, 2018

It seems this is actually to large extent doable now, please refer to #125 and this test 7ecae69
While it's supported, the documentation is beyond the scope of osim-rl for now -- you can find the details on the SimBody side https://github.com/simbody/simbody

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants