cage-challenge-4
cage-challenge-4 copied to clipboard
Action Padding results in inconsistent action spaces across agents
Description
Currently when pad_spaces
is set, action spaces are padded out to be the same size across all agents. However, this is done by simply appending enough [Padding] Sleep()
actions to the end of the action space.
https://github.com/cage-challenge/cage-challenge-4/blob/313bf330e5229663606de08df0d0d5135b55961d/CybORG/Agents/Wrappers/BlueFixedActionWrapper.py#L316-L317
This results in an action space that is the correct size, however the larger action space is not aligned across the smaller and larger agents. The problem is each action type (e.g. Analyse
, Remove
, etc) has e.g. 16 entries in the small agents and 48 entries in the large agents and the action space is sorted by Action type.
For example, when padding spaces, the first 4 small agents (Blue Agent 0-3) all have a Monitor
action as action 16, however Blue Agent 4 has another Analyse
action.
Steps to Reproduce
from CybORG.Simulator.Scenarios import EnterpriseScenarioGenerator
from CybORG import CybORG
from CybORG.Agents.Wrappers import EnterpriseMAE
sg = EnterpriseScenarioGenerator()
cyborg = CybORG(sg)
wrapped_cyborg = EnterpriseMAE(cyborg, pad_spaces=True)
print(f"Small Action: {wrapped_cyborg._action_space['blue_agent_0']['labels'][49]}")
print(f"Large Action: {wrapped_cyborg._action_space['blue_agent_4']['labels'][49]}")
Expected behavior
Instead of just extending the action space when applying padding, the appropriate number of padding should be inserted after each action type. This would ensure that the action numbers across padded environments have the same semantic meaning, e.g. Action 49 is Remove for all Agents when pad_spaces = True
.