yawning_titan.envs.specific.nsa_node_def.NodeEnv#

class yawning_titan.envs.specific.nsa_node_def.NodeEnv(chance_to_spread=0.01, chance_to_spread_during_patch=0.01, chance_to_randomly_compromise=0.15, cost_of_isolate=10, cost_of_patch=5, cost_of_nothing=0, end=1000, spread_vs_random_intrusion=0.5, punish_for_isolate=False, reward_method=1, network=None)[source]#

Bases: Env

Class that creates a similar environments to that presented in Ridley 17 (Ref above).

Methods

close

Override close in your subclass to perform any necessary cleanup.

render

Render the network using the graph2plot class.

reset

Reset the environment to the default state.

seed

Sets the seed for this env's random number generator(s).

step

Take one timestep within the environment.

Attributes

action_space = None#
observation_space = None#
reset()[source]#

Reset the environment to the default state.

Returns:

A new starting observation (numpy array)

step(action)[source]#

Take one timestep within the environment.

Execute the actions for both Blue RL agent and hard-hard coded Red agent.

Parameters:

action – The action value generated from the Blue RL agent (int)

Returns:

The next environment observation (numpy array) reward: The reward value for that timestep (int) done: Whether the epsiode is done (bool) info: a dictionary containing info about the current state

Return type:

observation

close()#

Override close in your subclass to perform any necessary cleanup.

Environments will automatically close() themselves when garbage collected or when the program exits.

metadata = {'render.modes': []}#
render(mode='human')[source]#

Render the network using the graph2plot class.

This uses a networkx representation of the network.

Parameters:

mode – the mode of the rendering

reward_range = (-inf, inf)#
seed(seed=None)#

Sets the seed for this env’s random number generator(s).

Note

Some environments use multiple pseudorandom number generators. We want to capture all such seeds used in order to ensure that there aren’t accidental correlations between multiple generators.

Returns:

Returns the list of seeds used in this env’s random

number generators. The first value in the list should be the “main” seed, or the value which a reproducer should pass to ‘seed’. Often, the main seed equals the provided ‘seed’, but this won’t be true if seed=None, for example.

Return type:

list<bigint>

spec = None#
property unwrapped#

Completely unwrap this env.

Returns:

The base non-wrapped gym.Env instance

Return type:

gym.Env