-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow reset num agents at run time (#444)
- Loading branch information
PENG Zhenghao
committed
May 18, 2021
1 parent
b2b1e36
commit bb7ca7b
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pgdrive.envs.marl_envs.marl_inout_roundabout import MultiAgentRoundaboutEnv | ||
|
||
|
||
def test_ma_env_force_reset(): | ||
e = MultiAgentRoundaboutEnv({'num_agents': 1}) | ||
e.reset() | ||
assert len(e.vehicles) == e.num_agents == len(e.config["target_vehicle_configs"]) == 1 | ||
|
||
e.close_and_reset_num_agents(num_agents=2) | ||
e.reset() | ||
assert len(e.vehicles) == e.num_agents == len(e.config["target_vehicle_configs"]) == 2 | ||
|
||
e.close_and_reset_num_agents(num_agents=5) | ||
e.reset() | ||
assert len(e.vehicles) == e.num_agents == len(e.config["target_vehicle_configs"]) == 5 | ||
|
||
e.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
test_ma_env_force_reset() |