rcognita.actors.ActorCALF

class rcognita.actors.ActorCALF(safe_controller, *args, actor_constraints_on=True, penalty_param=0, actor_regularization_param=0, **kwargs)

Actor using Critic As a Lyapunov Function (CALF) to constrain the optimization.

__init__(safe_controller, *args, actor_constraints_on=True, penalty_param=0, actor_regularization_param=0, **kwargs)

Initialize the actor with a safe controller, and optional arguments for constraint handling, penalty term, and actor regularization.

Parameters
  • safe_controller (Controller) – controller used to compute a safe action in case the optimization is rejected

  • actor_constraints_on (bool) – whether to use the CALF constraints in the optimization

  • penalty_param (float) – penalty term for the optimization objective

  • actor_regularization_param (float) – regularization term for the actor weights

Methods

CALF_decay_constraint_for_actor(weights)

Constraint for the actor optimization, ensuring that the critic value will not decrease by less than the required decay rate.

CALF_decay_constraint_for_actor_same_critic(weights)

Calculate the predictive constraint violation for the CALF.

__init__(safe_controller, *args[, …])

Initialize the actor with a safe controller, and optional arguments for constraint handling, penalty term, and actor regularization.

accept_or_reject_weights(weights[, …])

Determines whether the given weights should be accepted or rejected based on the specified constraints.

cache_weights([weights])

Cache the current weights of the model of the actor.

create_observation_constraints(…)

Method to create observation (or state) related constraints using a predictor over a prediction_horizon.

objective(action_sequence, observation)

Calculates the actor objective for the given action sequence and observation using Running Plus Optimal (RPO).

optimize_weights([constraint_functions, time])

Method to optimize the current actor weights.

receive_observation(observation)

Update the current observation of the actor.

reset()

Reset the actor to its initial state.

restore_weights()

Restore the previously cached weights of the model of the actor.

set_action(action)

Set the current action of the actor.

update_action([observation])

Update the current action of the actor.

update_and_cache_weights([weights])

Update and cache the weights of the model of the actor.

update_weights([weights])

Update the weights of the model of the actor.