rcognita.systems.System
- class rcognita.systems.System(sys_type: str, dim_state: int, dim_input: int, dim_output: int, dim_disturb: int, pars: Optional[list] = None, is_dynamic_controller: bool = 0, is_disturb: bool = 0, pars_disturb: Optional[list] = None)
Interface class of dynamical systems a.k.a. environments. Concrete systems should be built upon this class. To design a concrete system: inherit this class, override:
compute_dynamics()
:right-hand side of system description (required)_compute_disturbance_dynamics()
:right-hand side of disturbance model (if necessary)_dynamic_control()
:right-hand side of controller dynamical model (if necessary)out()
:system out (if not overridden, output is identical to state)- sys_type: string
Type of system by description:
diff_eqn
: differential equation \(\mathcal D state = f(state, action, disturb)\)discr_fnc
: difference equation \(state^+ = f(state, action, disturb)\)discr_prob
: by probability distribution \(X^+ \sim P_X(state^+| state, action, disturb)\)
where:
\(state\) : state\(action\) : input\(disturb\) : disturbanceThe time variable
time
is commonly used by ODE solvers, and you shouldn’t have it explicitly referenced in the definition, unless your system is non-autonomous. For the latter case, however, you already have the input and disturbance at your disposal.Parameters of the system are contained in
pars
attribute.- dim_state, dim_input, dim_output, dim_disturb: integer
System dimensions
- pars: list
List of fixed parameters of the system
- action_bounds: array of shape
[dim_input, 2]
Box control constraints. First element in each row is the lower bound, the second - the upper bound. If empty, control is unconstrained (default)
- is_dynamic_controller: 0 or 1
If 1, the controller (a.k.a. agent) is considered as a part of the full state vector
- is_disturb: 0 or 1
If 0, no disturbance is fed into the system
- pars_disturb: list
Parameters of the disturbance model
Each concrete system must realize
System
and definename
attribute.- __init__(sys_type: str, dim_state: int, dim_input: int, dim_output: int, dim_disturb: int, pars: Optional[list] = None, is_dynamic_controller: bool = 0, is_disturb: bool = 0, pars_disturb: Optional[list] = None)
- Parameters
sys_type (: string) –
Type of system by description:
diff_eqn
: differential equation \(\mathcal D state = f(state, action, disturb)\)discr_fnc
: difference equation \(state^+ = f(state, action, disturb)\)discr_prob
: by probability distribution \(X^+ \sim P_X(state^+| state, action, disturb)\)where –
\(state\) : state\(action\) : input\(disturb\) : disturbancetime variable time is commonly used by ODE solvers (The) –
you shouldn't have it explicitly referenced in the definition (and) –
your system is non-autonomous. (unless) –
the latter case (For) –
however –
already have the input and disturbance at your disposal. (you) –
of the system are contained in pars attribute. (Parameters) –
dim_state (: integer) – System dimensions
dim_input (: integer) – System dimensions
dim_output (: integer) – System dimensions
dim_disturb (: integer) – System dimensions
pars (: list) – List of fixed parameters of the system
action_bounds (: array of shape
[dim_input, 2]
) – Box control constraints. First element in each row is the lower bound, the second - the upper bound. If empty, control is unconstrained (default)is_dynamic_controller (: 0 or 1) – If 1, the controller (a.k.a. agent) is considered as a part of the full state vector
is_disturb (: 0 or 1) – If 0, no disturbance is fed into the system
pars_disturb (: list) – Parameters of the disturbance model
Methods
__init__
(sys_type, dim_state, dim_input, …)- param sys_type
Type of system by description:
compute_closed_loop_rhs
(time, state_full)Right-hand side of the closed-loop system description.
compute_dynamics
(time, state, action, disturb)Description of the system internal dynamics.
out
(state[, time, action])System output.
receive_action
(action)Receive exogeneous control action to be fed into the system.
reset
()