-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update environment creation tutorials (#1082)
Co-authored-by: ggsavin <[email protected]>
- Loading branch information
1 parent
f0c94c6
commit c3dc056
Showing
33 changed files
with
114 additions
and
27 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,16 @@ | ||
import aec_rps | ||
|
||
env = aec_rps.env(render_mode="human") | ||
env.reset(seed=42) | ||
|
||
for agent in env.agent_iter(): | ||
observation, reward, termination, truncation, info = env.last() | ||
|
||
if termination or truncation: | ||
action = None | ||
else: | ||
# this is where you would insert your policy | ||
action = env.action_space(agent).sample() | ||
|
||
env.step(action) | ||
env.close() |
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,11 @@ | ||
import parallel_rps | ||
|
||
env = parallel_rps.parallel_env(render_mode="human") | ||
observations, infos = env.reset() | ||
|
||
while env.agents: | ||
# this is where you would insert your policy | ||
actions = {agent: env.action_space(agent).sample() for agent in env.agents} | ||
|
||
observations, rewards, terminations, truncations, infos = env.step(actions) | ||
env.close() |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pettingzoo[butterfly,atari,testing]>=1.23.1 | ||
pettingzoo[butterfly,atari,testing]>=1.24.0 | ||
SuperSuit>=3.9.0 | ||
tensorboard>=2.11.2 | ||
torch>=1.13.1 |
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 @@ | ||
pettingzoo==1.24.0 |
File renamed without changes.
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
11 changes: 11 additions & 0 deletions
11
tutorials/CustomEnvironment/tutorial4_testing_the_environment.py
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,11 @@ | ||
from tutorial2_adding_game_logic import CustomEnvironment | ||
from tutorial3_action_masking import CustomActionMaskedEnvironment | ||
|
||
from pettingzoo.test import parallel_api_test | ||
|
||
if __name__ == "__main__": | ||
env = CustomEnvironment() | ||
parallel_api_test(env, num_cycles=1_000_000) | ||
|
||
env = CustomActionMaskedEnvironment() | ||
parallel_api_test(env, num_cycles=1_000_000) |
Empty file.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
tutorials/EnvironmentCreation/tutorial4_testing_the_environment.py
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
PettingZoo[classic, butterfly]==1.23.1 | ||
PettingZoo[classic,butterfly]>=1.24.0 | ||
Pillow>=9.4.0 | ||
ray[rllib]>2.6.2 | ||
SuperSuit==3.8.0 | ||
# note: currently requires nightly release, see https://docs.ray.io/en/latest/ray-overview/installation.html#daily-releases-nightlies | ||
ray[rllib]>2.6.3 | ||
SuperSuit>=3.9.0 | ||
torch>=1.13.1 | ||
tensorflow-probability>=0.19.0 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pettingzoo[classic]>=1.23.1 | ||
pettingzoo[classic]>=1.24.0 | ||
stable-baselines3>=2.0.0 | ||
sb3-contrib>=2.0.0 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pettingzoo[butterfly]>=1.23.1 | ||
pettingzoo[butterfly]>=1.24.0 | ||
stable-baselines3>=2.0.0 | ||
supersuit>=3.9.0 |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pettingzoo[butterfly]>=1.23.1 | ||
pettingzoo[butterfly]>=1.24.0 | ||
stable-baselines3>=2.0.0 | ||
supersuit>=3.9.0 |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pettingzoo[classic]>=1.23.1 | ||
pettingzoo[classic]>=1.24.0 | ||
stable-baselines3>=2.0.0 | ||
sb3-contrib>=2.0.0 | ||
pytest |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pettingzoo[sisl]>=1.23.1 | ||
pettingzoo[sisl]>=1.24.0 | ||
stable-baselines3>=2.0.0 | ||
supersuit>=3.9.0 | ||
pymunk |