Skip to content

Update gym to gymnasium#43

Open
IlyaOrson wants to merge 4 commits intocage-challenge:cage-challenge-2from
IlyaOrson:cage-challenge-2
Open

Update gym to gymnasium#43
IlyaOrson wants to merge 4 commits intocage-challenge:cage-challenge-2from
IlyaOrson:cage-challenge-2

Conversation

@IlyaOrson
Copy link

With this update the environment can be trained with stable baselines 3:

import inspect
from stable_baselines3 import PPO # A2C

from CybORG import CybORG
from CybORG.Agents import RedMeanderAgent
from CybORG.Agents.Wrappers import ChallengeWrapper

max_steps = 50
agent_name = "Blue"

path = str(inspect.getfile(CybORG))
path = path[:-10] + '/Shared/Scenarios/Scenario2.yaml'
cyborg = CybORG(path, "sim", agents={'Red': RedMeanderAgent})
env = ChallengeWrapper(agent_name=agent_name, env=cyborg, max_steps=max_steps)

model = PPO("MlpPolicy", env, verbose=1, device="cpu")
model.learn(total_timesteps=100_000, progress_bar=True)

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

Successfully merging this pull request may close these issues.

1 participant