yawning_titan.envs.generic.wrappers.graph_embedding_observations#
Classes
Gym Observation Space Wrapper that embeds the underlying environment graph using the Feather-G algorithm. |
- class yawning_titan.envs.generic.wrappers.graph_embedding_observations.FeatherGraphEmbedObservation(env, max_num_nodes=100)[source]#
Gym Observation Space Wrapper that embeds the underlying environment graph using the Feather-G algorithm.
This wrapper uses the Feather-G Whole Graph embedding algorithm to embed the underlying environment graph and then re-creates the observation space to include the embedding and all other observation space settings from the configuration file.
Initialise a Feather-G observation space wrapper.
- Parameters:
env – the OpenAI Gym environment to be wrapped
max_num_nodes – the maximum number of nodes required to be supported in the observation space
Note
The max_num_nodes is for defining the maximum number of nodes you want the agent to support within its observation space. This is in order to support the training of agents which can work across a number of YAWNING TITAN environments with variable node counts.
For example, if set to 100 (like the default), the agent could be trained in an environment with 10 nodes, 50 nodes or 100 nodes.
- __init__(env, max_num_nodes=100)[source]#
Initialise a Feather-G observation space wrapper.
- Parameters:
env – the OpenAI Gym environment to be wrapped
max_num_nodes – the maximum number of nodes required to be supported in the observation space
Note
The max_num_nodes is for defining the maximum number of nodes you want the agent to support within its observation space. This is in order to support the training of agents which can work across a number of YAWNING TITAN environments with variable node counts.
For example, if set to 100 (like the default), the agent could be trained in an environment with 10 nodes, 50 nodes or 100 nodes.
- observation(observation)[source]#
Observation Transformation Function.
Generates a networkx graph object from the current adjacency matrix
Collects the current vulnerability scores and node status’s
Pads the returned arrays to ensure length is 100 (currently arbitrarily set)
Embeds the networkx graph using the Feather Graph algorithm from Karateclub
Concatenates the graph embedding, padded vulnerability scores and padded node status’s together
Returns new observation
- Parameters:
observation – The base, unwrapped observation generated by the environment
- Returns:
A newly formatted environment observation