[RLlib] Refine MultiAgentEpisode and add test cases.#40799
Merged
sven1977 merged 52 commits intoray-project:masterfrom Nov 28, 2023
Merged
[RLlib] Refine MultiAgentEpisode and add test cases.#40799sven1977 merged 52 commits intoray-project:masterfrom
MultiAgentEpisode and add test cases.#40799sven1977 merged 52 commits intoray-project:masterfrom
Conversation
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…ization, timestep mapping and class data. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…ule states will only be stored in the 'SingleAgentEpisode's. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…et_return' and '__len__'. Moved episode files into 'rllib/env'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…one. Furthermore moved 'SingleAgentEpisode' and 'MultiAgentEpisode' towards 'rllib/env'. I also added unit testing for 'SingleAgentEpisode'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…de into branch episode. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…AgentEpisode'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…r-mae Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
… 'add_timestep()'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
… and agents that terminate before stepping first time. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…le of functionalitites in 'MultiAgentEPisode'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
simonsays1980
commented
Nov 3, 2023
…ntense testing led to further changes in the 'MultiAgentEpisode', specifically as we do need for the successor results from 'get_observations()', 'get_infos', etc. in type 'List[MultiAgentDict]' and not 'MultiAgentDict'. Furthermore, 'terminateds' and 'truncateds' hat to be provided with a getter. Needs more testing. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…tEpisode's. Also added corresponding tests. Rnamed 'global_rewards' to 'partial_rewards'. This is an intermediate commit to have a safe state to return to. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…encies in the use of the ' partial_rewards'. Has to be fixed before stepping forward. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…ere removed from 'SingleAgentEpisode by @sven1977. Added test for getters. Needed to change '_getattr_by_index' as using buffered actions is non-trivial. Had to add a 'global_actions_t' timestep_mapping for the actions as they could be buffered and the original timestep would get lost. Testing is not finished. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
… of using buffered actions. Thereby refactored '_getattr_by_index()' extensively to be used more generically. Furthermore, wrote corresponding tests. Fixed a bug in the 'create_successor()' method. All tests run. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…ards, but with receiving either 'MultiAgentDict' or 'List[MutliAgentDict]'. Made minor changes to '_IndexMapping' and '_getattr_by_index()'. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…ded buffered rewards to the 'get_rewards' method. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…wards' is complete now and needs to be tested more. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…e for some days now. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…le testing. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…t_episode()' to use the corresponding 'SingleAgentEpisode''s methods, to contain as initial observation in the successor always the last observation of an agent. Adjusted tests accordingly and added multiple new ones. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…method to 'MultiAgentEpisode' for immutable copying of buffers between episodes. Refined the test file. Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
…fied these functions to account for empty episodes and agents that are done.' Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
MultiAgentEpisode and add test cases.
sven1977
approved these changes
Nov 28, 2023
Contributor
sven1977
left a comment
There was a problem hiding this comment.
LGTM for now. Let's merge this to make some progress here.
We will have to:
- Rename the MAE APIs to: add_env_reset/add_env_step
- Enhance the getter APIs to allow for more options, such as
one_hot_discrete,fill, etc.. analogous to the upcoming SingleAgentEpisode enhancements. - Add the infinite lookback buffer functionality to MAE.
…ing-multi-agent-episode
ujjawal-khare
pushed a commit
to ujjawal-khare-27/ray
that referenced
this pull request
Nov 29, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
The
MultiAgentEpisodeneeds buffers to recordaction,reward,state, andextra_model_outputin case an agent has acted at a timestep, but not received a next observation, yet. The appropriate logic for adding timesteps should be implemented here together with extensive testing to ensure in this complex area precise execution.Related issue number
Clsoes #40746
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.