deluca.agents.DRC

class deluca.agents.DRC(*args, **kwargs)[source]

Public Data Attributes:

Inherited from JaxObject

name

attrs

Public Methods:

__init__(A, B[, C, K, cost_fn, m, h, …])

Description: Initialize the dynamics of the model.

__call__(obs)

Description: Return the action based on current state and internal parameters.

get_action(obs)

Description: get action from state.

update(obs, u)

update_noise(obs)

update_params(obs, u)

Description: update agent internal state.

Inherited from Agent

__init_subclass__(*args, **kwargs)

For avoiding a decorator for each subclass

__call__(obs)

Description: Return the action based on current state and internal parameters.

reset()

feed(reward)

Inherited from JaxObject

__new__(cls, *args, **kwargs)

For avoiding super().__init__()

__init_subclass__(*args, **kwargs)

For avoiding a decorator for each subclass

__str__()

Return str(self).

__setattr__(key, val)

Implement setattr(self, name, value).

save(path)

load(path)

throw(err, msg)


__call__(obs: jax._src.numpy.lax_numpy.ndarray) → jax._src.numpy.lax_numpy.ndarray[source]

Description: Return the action based on current state and internal parameters.

Parameters

state (jnp.ndarray) – current state

Returns

action to take

Return type

jnp.ndarray

__init__(A: jax._src.numpy.lax_numpy.ndarray, B: jax._src.numpy.lax_numpy.ndarray, C: jax._src.numpy.lax_numpy.ndarray = None, K: jax._src.numpy.lax_numpy.ndarray = None, cost_fn: Callable[[jax._src.numpy.lax_numpy.ndarray, jax._src.numpy.lax_numpy.ndarray], numbers.Real] = None, m: int = 10, h: int = 50, lr_scale: numbers.Real = 0.03, decay: bool = True, RM: int = 1000, seed: int = 0) → None[source]

Description: Initialize the dynamics of the model.

Parameters
  • A (jnp.ndarray) – system dynamics

  • B (jnp.ndarray) – system dynamics

  • C (jnp.ndarray) – system dynamics

  • Q (jnp.ndarray) – cost matrices (i.e. cost = x^TQx + u^TRu)

  • R (jnp.ndarray) – cost matrices (i.e. cost = x^TQx + u^TRu)

  • K (jnp.ndarray) – Starting policy (optional). Defaults to LQR gain.

  • start_time (int) –

  • cost_fn (Callable[[jnp.ndarray, jnp.ndarray], Real]) –

  • H (postive int) – history of the controller

  • HH (positive int) – history of the system

  • lr_scale (Real) –

  • decay (boolean) –

  • seed (int) –

get_action(obs: jax._src.numpy.lax_numpy.ndarray) → jax._src.numpy.lax_numpy.ndarray[source]

Description: get action from state.

Parameters

state (jnp.ndarray) –

Returns

jnp.ndarray

update_params(obs: jax._src.numpy.lax_numpy.ndarray, u: jax._src.numpy.lax_numpy.ndarray) → None[source]

Description: update agent internal state.

Parameters

state (jnp.ndarray) –

Returns

None