Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
William Blum committed Aug 6, 2024
1 parent e729fb0 commit e0155b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 0 additions & 9 deletions cyberbattle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ def register(id: str, cyberbattle_env_identifiers: model.Identifiers, **kwargs):
if id in registry:
raise Error("Cannot re-register id: {}".format(id))
spec = EnvSpec(id, **kwargs)
# Map from port number to port names : List[model.PortName]
spec.ports = cyberbattle_env_identifiers.ports
# Array of all possible node properties (not necessarily all used in the network) : List[model.PropertyName]
spec.properties = cyberbattle_env_identifiers.properties
# Array defining an index for every possible local vulnerability name : List[model.VulnerabilityID]
spec.local_vulnerabilities = cyberbattle_env_identifiers.local_vulnerabilities
# Array defining an index for every possible remote vulnerability name : List[model.VulnerabilityID]
spec.remote_vulnerabilities = cyberbattle_env_identifiers.remote_vulnerabilities

registry[id] = spec


Expand Down
6 changes: 3 additions & 3 deletions notebooks/stable-baselines-agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@

# %%
if "a2c" in retrain:
model_a2c = A2C("MultiInputPolicy", env2).learn(10000)
model_a2c = A2C("MultiInputPolicy", env2).learn(10000) # type: ignore
model_a2c.save("a2c_trained_toyctf")


# %%
if "ppo" in retrain:
model_ppo = PPO("MultiInputPolicy", env2).learn(100)
model_ppo = PPO("MultiInputPolicy", env2).learn(100) # type: ignore
model_ppo.save("ppo_trained_toyctf")


# %%
model = A2C("MultiInputPolicy", env2).load("a2c_trained_toyctf")
model = A2C("MultiInputPolicy", env2).load("a2c_trained_toyctf") # type: ignore
# model = PPO("MultiInputPolicy", env2).load('ppo_trained_toyctf')


Expand Down

0 comments on commit e0155b8

Please sign in to comment.