Dynamics Functions

Deterministic Dynamics MLP Function

class blackbox_mpc.dynamics_functions.DeterministicMLP(layers, activation_functions, loss_fn=<tensorflow.python.keras.losses.MeanSquaredError object>, name=None)[source]
__call__(x, train)[source]

This is the call function for the deterministic fully connected MLP dynamics function class.

Parameters
  • x (tf.float32) – Defines the (s_t, a_t) which is the state and action stacked on top of each other, (dims = Batch X (dim_S + dim_U))

  • train (tf.bool) – Defines whether the network should run in train mode or not.

Returns

output – Defines the next state (s_t+1) with (dims = Batch X dim_S)

Return type

tf.float32

__init__(layers, activation_functions, loss_fn=<tensorflow.python.keras.losses.MeanSquaredError object>, name=None)[source]

A deterministic fully connected MLP dynamics function class for (s_t, a_t) - > (s_t+1)

Parameters

name (str) – Defines the name of the block of the deterministic MLP dynamics function.

get_loss(expected_output, predictions)[source]

This is the training loss function for the deterministic fully connected MLP dynamics function class.

Parameters
  • expected_output (tf.float32) – Defines the next state (s_t+1) ground truth with (dims = Batch X dim_S)

  • predictions (tf.float32) – Defines the next state (s_t+1) predicted values with (dims = Batch X dim_S)

Returns

train_loss – Defines the training loss as a scalar for the whole batch

Return type

tf.float32

get_validation_loss(expected_output, predictions)[source]

This is the validation loss function for the deterministic fully connected MLP dynamics function class.

Parameters
  • expected_output (tf.float32) – Defines the next state (s_t+1) ground truth with (dims = Batch X dim_S)

  • predictions (tf.float32) – Defines the next state (s_t+1) predicted values with (dims = Batch X dim_S)

Returns

validation_loss – Defines the validation loss as a scalar for the whole batch

Return type

tf.float32