deluca.agents.GPC

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

Public Data Attributes:

Inherited from JaxObject

name

attrs

Public Methods:

__init__(A, B[, Q, R, K, start_time, …])

Description: Initialize the dynamics of the model.

__call__(state)

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

update(state, u)

Description: update agent internal state.

get_action(state)

Description: get action from state.

Inherited from Agent

__init_subclass__(*args, **kwargs)

For avoiding a decorator for each subclass

__call__(state)

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__(state: 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, Q: jax._src.numpy.lax_numpy.ndarray = None, R: jax._src.numpy.lax_numpy.ndarray = None, K: jax._src.numpy.lax_numpy.ndarray = None, start_time: int = 0, cost_fn: Callable[[jax._src.numpy.lax_numpy.ndarray, jax._src.numpy.lax_numpy.ndarray], numbers.Real] = None, H: int = 3, HH: int = 2, lr_scale: numbers.Real = 0.005, decay: bool = True) → None[source]

Description: Initialize the dynamics of the model.

Parameters
  • A (jnp.ndarray) – system dynamics

  • B (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) –

  • lr_scale_decay (Real) –

  • decay (Real) –

get_action(state: 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(state: 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