Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action Padding results in inconsistent action spaces across agents #43

Open
dvanbrug opened this issue May 10, 2024 · 0 comments · May be fixed by #48
Open

Action Padding results in inconsistent action spaces across agents #43

dvanbrug opened this issue May 10, 2024 · 0 comments · May be fixed by #48
Assignees

Comments

@dvanbrug
Copy link

dvanbrug commented May 10, 2024

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.

def pad_actions(size, agent_name, key, value):
self._action_space[agent_name][key].extend([value] * size)

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.

@cage-challenge cage-challenge self-assigned this May 28, 2024
@dvanbrug dvanbrug linked a pull request Aug 5, 2024 that will close this issue
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 a pull request may close this issue.

2 participants