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

[RLlib] Refine MultiAgentEpisode and add test cases. #40799

Merged
merged 52 commits into from
Nov 28, 2023

Commits on Oct 11, 2023

  1. Initialized MultiAgentEpisode.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 11, 2023
    Configuration menu
    Copy the full SHA
    afc0e17 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2023

  1. Added timestep mapping and necessary methods to MultiAgentEpisode.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 12, 2023
    Configuration menu
    Copy the full SHA
    c6c8275 View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. Added get_<data> - methods to 'MultiAgentEpisode' and refined initial…

    …ization, timestep mapping and class data.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    7b423ce View commit details
    Browse the repository at this point in the history
  2. Added 'create_successor', Äget_state()' and 'from_state()'. Agent mod…

    …ule states will only be stored in the 'SingleAgentEpisode's.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    d7a50fa View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Refactored 'self.t' and 'self.t_started'. Added 'to_sample_batch', 'g…

    …et_return' and '__len__'. Moved episode files into 'rllib/env'.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    02ea5b8 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. Added list conversion to 'from_sample_batch' in case episode is not d…

    …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>
    simonsays1980 committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    ac189c5 View commit details
    Browse the repository at this point in the history
  2. Ran linter.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    c84525a View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2023

  1. Adding docstrings.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    f3d88ec View commit details
    Browse the repository at this point in the history
  2. Adding docstrings.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    9112f38 View commit details
    Browse the repository at this point in the history
  3. Merged Master

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    7f860a5 View commit details
    Browse the repository at this point in the history
  4. LINTER

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 25, 2023
    Configuration menu
    Copy the full SHA
    a8b3b1d View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Added documentation to 'SingleAgentEpisode' and merged existing episo…

    …de into branch episode.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    b4ea186 View commit details
    Browse the repository at this point in the history
  2. Fixed some bugs found during testing and finished testing for 'Single…

    …AgentEpisode'.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    fd71c17 View commit details
    Browse the repository at this point in the history
  3. Implemented review from @sven1977 and changed docstrings a bit.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    03cce90 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2023

  1. Changed import for 'SingleAgentEpisode' to fix some errors in CI tests.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    47e88e6 View commit details
    Browse the repository at this point in the history
  2. Refactored 'get_observations|rewards|actions' into helper funciton.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    1a62530 View commit details
    Browse the repository at this point in the history
  3. Refactored 'get_observations|rewards|actions' into helper funciton.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    9056dfe View commit details
    Browse the repository at this point in the history
  4. Added infos to 'MUltiAgentEpiosde'.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    0d8e324 View commit details
    Browse the repository at this point in the history
  5. Fixed imports and the resulting bug in 'single_agent_gym_env_runner.py'.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    879b080 View commit details
    Browse the repository at this point in the history
  6. Added 'extra_model_outputs' to 'MultiAgentEpisode'.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    b53e122 View commit details
    Browse the repository at this point in the history
  7. Merge branch 'multi-agent-episode' into infos-and-extra-model-outs-fo…

    …r-mae
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    77e6296 View commit details
    Browse the repository at this point in the history
  8. Implemented @sven1977 's review.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    96e9d21 View commit details
    Browse the repository at this point in the history
  9. Implemented @sven1977 's review.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    277282e View commit details
    Browse the repository at this point in the history
  10. Implemented @sven1977 's review.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    ccce22c View commit details
    Browse the repository at this point in the history
  11. Merged branch 'multi-agent-epsiode' into branch.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    72bc8f5 View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2023

  1. Started testing for MultiAgentEpisode.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 28, 2023
    Configuration menu
    Copy the full SHA
    9300309 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Added buffers to the 'MultiAgentEpisode' and a corresponding logic to…

    … 'add_timestep()'.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    c786e06 View commit details
    Browse the repository at this point in the history

Commits on Oct 31, 2023

  1. Refined 'add_timestep()' in 'MultiAgentEpisode' to handle also states…

    … and agents that terminate before stepping first time.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 31, 2023
    Configuration menu
    Copy the full SHA
    68d5478 View commit details
    Browse the repository at this point in the history
  2. Added first test with multi-agent test environment and refined a coup…

    …le of functionalitites in 'MultiAgentEPisode'.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 31, 2023
    Configuration menu
    Copy the full SHA
    d18d4a7 View commit details
    Browse the repository at this point in the history
  3. Added test scenarios and modified testing environment.

    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 31, 2023
    Configuration menu
    Copy the full SHA
    de6bab0 View commit details
    Browse the repository at this point in the history
  4. Added a test for 'add_initial_observation' and fixed some minor bug i…

    …n the generation of the global timestep mapping.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Oct 31, 2023
    Configuration menu
    Copy the full SHA
    09f9e3a View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2023

  1. Added test for 'add_timestep', made intensive testing, modified 'add_…

    …timestep' to deal directly with 'done' agents and also to skip partial testing for is_terminated/is_truncated. Furthermore, adjusted all functions to deal with 'terminated' and Ätruncated' dictionaries that contain only ready agents.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    b57bef7 View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2023

  1. Added more testing for 'add_timestep()' and '__init__()'. Fixed some …

    …bugs in 'add_timestep()' and '__init__()' methods in 'MultiAgentEpisode' to handle agents that never stepped and to handle the '__all__' in 'terminated' and 'truncated'. Changed '_agent_ids' to 'set' instead of 'list'.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    4e07c41 View commit details
    Browse the repository at this point in the history
  2. Added global reward list and global reward timestep mapping to keep t…

    …rack of 'orphane' rewards in multi-agent environemnts that occur in between an agent's action and the nex tobservation or before the initial observation. Furthermore, changed data extraction for single agents to take care of siutations in which collected data contains 'orphane' actions, i.e. actions that miss their subsequent observation. Orphane actions, states, and extra model outputs are put into the buffer. Ensured that tests are making use of these functionalities.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 3, 2023
    Configuration menu
    Copy the full SHA
    fda7ef8 View commit details
    Browse the repository at this point in the history

Commits on Nov 8, 2023

  1. Added test cases for 'create_successor' in the 'MultiAgentEpisode'. I…

    …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>
    simonsays1980 committed Nov 8, 2023
    Configuration menu
    Copy the full SHA
    b8b530c View commit details
    Browse the repository at this point in the history

Commits on Nov 9, 2023

  1. Added functionalities to transfer buffers to successors of 'MultiAgen…

    …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>
    simonsays1980 committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    8d6ac06 View commit details
    Browse the repository at this point in the history
  2. Added more tests to the 'test_create_successor'. Found some incpnsist…

    …encies in the use of the ' partial_rewards'. Has to be fixed before stepping forward.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 9, 2023
    Configuration menu
    Copy the full SHA
    2d375ee View commit details
    Browse the repository at this point in the history

Commits on Nov 13, 2023

  1. Removed states and related methods from 'MultiAgentEpisode' as they w…

    …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>
    simonsays1980 committed Nov 13, 2023
    Configuration menu
    Copy the full SHA
    9aabdac View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2023

  1. Finished 'get_actions()' and 'get_extra_model_outputs()' for the case…

    … 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>
    simonsays1980 committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    53121d8 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2023

  1. Finished testing for 'get_rewards()' without partial and buffered rew…

    …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>
    simonsays1980 committed Nov 15, 2023
    Configuration menu
    Copy the full SHA
    225eb68 View commit details
    Browse the repository at this point in the history
  2. Added methods to '_IndexMapping' for more complex index searching. Ad…

    …ded buffered rewards to the 'get_rewards' method.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 15, 2023
    Configuration menu
    Copy the full SHA
    f0fb853 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2023

  1. Added functionality for buffered_rewards and partial rewards. 'get_re…

    …wards' is complete now and needs to be tested more.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 17, 2023
    Configuration menu
    Copy the full SHA
    7d408aa View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. Added the file for testing the 'MultiAgentEpisode'. Worked on the fil…

    …e for some days now.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 18, 2023
    Configuration menu
    Copy the full SHA
    6bdc9e6 View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2023

  1. Finished testing for getters and fixed some minor bugs I ran over whi…

    …le testing.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    b42decf View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2023

  1. Fixed several minor bugs and modified 'create_successor()' and 'conca…

    …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>
    simonsays1980 committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    c0802ad View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2023

  1. Finished testing for 'concat_episode()'. Also added a '_copy_buffer' …

    …method to 'MultiAgentEpisode' for immutable copying of buffers between episodes. Refined the test file.
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 23, 2023
    Configuration menu
    Copy the full SHA
    040ad60 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2023

  1. Added tests for 'to_sample_batch', '__len__', and 'get_returns'. Modi…

    …fied these functions to account for empty episodes and agents that are done.'
    
    Signed-off-by: Simon Zehnder <simon.zehnder@gmail.com>
    simonsays1980 committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    7d570e1 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2023

  1. wip

    Signed-off-by: sven1977 <svenmika1977@gmail.com>
    sven1977 committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    d23f959 View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2023

  1. wip

    Signed-off-by: sven1977 <svenmika1977@gmail.com>
    sven1977 committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    a8937f3 View commit details
    Browse the repository at this point in the history
  2. wip

    Signed-off-by: sven1977 <svenmika1977@gmail.com>
    sven1977 committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    721ff00 View commit details
    Browse the repository at this point in the history
  3. Merge branch 'master' of https://github.com/ray-project/ray into test…

    …ing-multi-agent-episode
    sven1977 committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    3a64881 View commit details
    Browse the repository at this point in the history
  4. wip

    Signed-off-by: sven1977 <svenmika1977@gmail.com>
    sven1977 committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    18ea675 View commit details
    Browse the repository at this point in the history