csle_agents.common package

Submodules

csle_agents.common.actor_critic_net module

csle_agents.common.fnn_w_gaussian module

class csle_agents.common.fnn_w_gaussian.FNNwithGaussian(input_dim: int, output_dim: int, hidden_dim: int, num_hidden_layers: int = 2, hidden_activation: str = 'ReLU')[source]

Bases: torch.nn.modules.module.Module

Implements a FNN with Gaussian output and parameterizable number of layers, dimensions, and hidden activations.

Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network

forward(x)[source]

Forward propagation

Parameters

x – input tensor

Returns

Output prediction

get_hidden_activation()[source]

Interprets the hidden activation

Returns

the hidden activation function

training: bool
csle_agents.common.fnn_w_gaussian.test() None[source]

A basic test-case to verify that the model can fit some randomly generated data

Returns

None

csle_agents.common.fnn_w_linear module

class csle_agents.common.fnn_w_linear.FNNwithLinear(input_dim: int, output_dim: int, hidden_dim: int, num_hidden_layers: int = 2, hidden_activation: str = 'ReLU')[source]

Bases: torch.nn.modules.module.Module

Implements a FNN with parameterizable number of layers, dimensions, and hidden activations.

Sub-classing the torch.nn.Module to be able to use high-level API for creating the custom network

forward(x)[source]

Forward propagation

Parameters

x – input tensor

Returns

Output prediction

get_hidden_activation()[source]

Interprets the hidden activation

Returns

the hidden activation function

training: bool
csle_agents.common.fnn_w_linear.test() None[source]

A basic test-case to verify that the model can fit some randomly generated data

Returns

None

csle_agents.common.objective_type module

class csle_agents.common.objective_type.ObjectiveType(value)[source]

Bases: enum.IntEnum

Enum representing different types of objectives

MAX = 1
MIN = 0

csle_agents.common.pruning module

csle_agents.common.pruning.check_dominance_lp(alpha_vec: numpy.ndarray[Any, numpy.dtype[Any]], Q: numpy.ndarray[Any, numpy.dtype[Any]])[source]

Uses LP to check whether a given alpha vector is dominated or not (Cassandra, Littman, Zhang, 1997)

Parameters
  • alpha_vec – the alpha vector to check

  • Q – the set of vectors to check dominance against

Returns

None if dominated, otherwise return the vector

csle_agents.common.pruning.check_duplicate(alpha_set: numpy.ndarray[Any, numpy.dtype[Any]], alpha: numpy.ndarray[Any, numpy.dtype[Any]]) bool[source]

Check whether alpha vector av is already in set a

Parameters
  • alpha_set – the set of alpha vectors

  • alpha – the vector to check

Returns

true or false

csle_agents.common.pruning.prune_lower_bound(lower_bound: numpy.ndarray[Any, numpy.dtype[Any]], S: numpy.ndarray[Any, numpy.dtype[Any]]) List[Any][source]

Lark’s filtering algorithm to prune the lower bound, (Cassandra, Littman, Zhang, 1997)

Parameters
  • lower_bound – the current lower bound

  • S – the set of states

Returns

the pruned lower bound

Module contents