or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Generalized Dynamical Systems
Suppose \(X\) is some object which has datastructure \(\mathcal{X}\), literally anything we can define but in practice we're using json like objects. (\(\mathcal{X}\) is really just a space but we're talking about representing that space in a computer)
\(X^+ = h(X)\)
The system model is a generalized dynamical system if
\(h:\mathcal{X} \rightarrow \mathcal{X}\)
there is a map \(h\) with domain and codomain \(\mathcal{X}\)
Our set of generalized dynamical systems is \(\mathcal{D}\) then a specifical one can be expressed as
\(d=(h, \mathcal{X})\in \mathcal{D}\) is the primitive concept here and we can these things as closed under composition. That is to say for any \(d_1,d_2\in \mathcal{D}\) then \(d_1 \circ d_2 \in \mathcal{D}\)
Now let's suppose that we wish to decompose the operator \(f\) to be comprised of inputs and updates as a consequence of these inputs, as is standard in control engineering:
\(u = g(X)\)
\(X^+ = f(X, u)\)
such that
\(h(X) = f(X, g(X))\)
Define a state transition function (aka mechanism) as \((f,\mathcal{X},U)\) with the following
\(U:\mathcal{X}\rightarrow \mathcal \wp({\mathcal{U}})\)
which gives us the set of admissible actions \(\mathcal{U}\) under the map
\(f:\mathcal{X} \times \mathcal{U} \rightarrow \mathcal{X}\)
for any selection \(g:\mathcal{X} \rightarrow \mathcal{U}\) we have a system of the type
\(f \circ g \in \mathcal{D}\)
this gives us a single "state update block".
Define a set of state update blocks \(h_i\) for \(i\in\{0,1,.., m\}\) where each \(h_i\) has \(f_i\) and \(g_i\) satisfying the conditions above for \(f\) and \(g\) respectively.
Sidebar
\(h_i:\mathcal{X}_i \rightarrow \mathcal{Y}_i\)
where \(\mathcal{X}_i,\mathcal{Y}_i \subset \mathcal{X}\)
suppose each \(h_i\) operates on \(x_i \subseteq X\) and mutates a subset \(y_i \subseteq X\). then we can examine the set of chains of composition which product equivalent results by considering the intersections of the various subsets \(x_i,y_i\) for all \(i\).
Then we will call each \(h_i\in \mathcal{D}\) a partial state update block and the entire state update is given by \(H\in \mathcal{X}\)
\(H(X)= h_m(h_{m-1}(...h_1(h_0(X)) ) )\)
where \(H:\mathcal{X} \rightarrow \mathcal{X}\) and is also a generalized dynamical system but the value of \(X\) passes through intermediate states so we will denote these substeps as \(X_i\) where \(X_m=X^+\).
\(X = X_m^-\)
\(X_0 = h_0(X) = f_0(X, g_0(X))\)
\(X_1 = h_1(X_0) = f_1(X_0, g_1(X_0))\)
\(\vdots\)
\(X_{m-1} = h_{m-1}(X_{m-2})= f_{m-1}(X_{m-2}, g_{m-1}(X_{m-2}))\)
\(X_m = h_m(X_{m-1})= f_m(X_{m-1}, g_m(X_{m-1}))\)
\(X^+ = X_m\)
A run is a sequence \(X_{i,t}\) where there is some initial condition \(X=\mathbf{X_0}=X_{\_,0}\) and we apply the first update
\(X_{0,1} = h_0(X)= h_0(X_{\_,0})\)
this gives us a loop:
for \(t\in\,range(T)\):
\(\qquad\) for \(i\in\,range(m)\)
\(\qquad\qquad u = g_i(X_{t,i-1})\)
\(\qquad\qquad X_{t,i}=f_i(X_{t,i-1}, u)\)
\(\qquad \qquad\)if \(i==m\):
\(\qquad \qquad\qquad \mathbf{X_t} = X_{t-1,m}\)
What is actually retained?
in the most expressive version we can store \(X_{t,i}\) for all \(i\) and \(t\)
next less would be \(\mathbf{X_t}\)
then the even more parsimonious would be \(\mathbf{Y_t} \subset \mathbf{X_t}\)
and if desired one could choose a different middleground with specific outputs \(Y_{i,t}\subset X_{i,t}\).
Potential future feature is to allow flagging of partial state updates to have their outputs stored and/or flag specific states to have their outputs stored even after the simulation itself will no longer reference them directly.
Relation to testing procedures
if we think of cadCAD as similar to ML algorithms in the sense that there is a valid sequence of transformers we can define a classes:
(suggestions)
Note that for testing purposes nearly everything about a simulation can be checked using pre and post conditions on the state objects \(\mathcal{X}\) and on the input signals \(u\in \mathcal{U}\) (associated with a specific \(f(X,u))\). Therefore the testing framework could work by defining classes of assertions:
Broadly speaking since we're doing this over arbitrary data structures, another family of assertions we could explore are checking units, if it is the case that fields the state can be said to have units, and if units themselves have well defined relations.
Example: Simple Scheme Declaration and Check
This example is drawn from the credCastle model being worked on by one cadCAD community "study group"
Define the state objects top level keys and assign them data types
The create an a genesis state:
Our state is defined by a set of keys declared in the schema.
Our genesis state has the same keys!
We also see that our genesis state respects the schema!
This simple example demonstrates the idea that we can declare boolean functions of over our state objects to verify that they are in fact in our statespace.
Also possible
cadCAD System in "Plain English"
In the cadCAD simulation methodology, we operate on four layers: Policies, Mechanisms, States, and Metrics. Information flows do not have explicit feedback loop unless noted. Policies determine the inputs into the system dynamics, and can come from user input, observations from the exogenous environment, or algorithms. Mechanisms are functions that take the policy decisions and update the States to reflect the policy level changes. States are variables that represent the system quantities at the given point in time, and Metrics are computed from state variables to assess the health of the system. Metrics can often be thought of as KPIs, or Key Performance Indicators.
At a more granular level, to setup a model, there are system conventions and configurations that must be followed.
The way to think of cadCAD modeling is analogous to machine learning pipelines which normally consist of multiple steps when training and running a deployed model. There is preprocessing, which includes segregating features between continuous and categorical, transforming or imputing data, and then instantiating, training, and running a machine learning model with specified hyperparameters. cadCAD modeling can be thought of in the same way as states, roughly translating into features, are fed into pipelines that have built-in logic to direct traffic between different mechanisms, such as scaling and imputation. Accuracy scores, ROC, etc are analogous to the metrics that can be configured on a cadCAD model, specifying how well a given model is doing in meeting its objectives. The parameter sweeping capability of cadCAD can be thought of as a grid search, or way to find the optimal hyperparameters for a system by running through alternative scenarios. A/B style testing that cadCAD enables is used in the same way machine learning models are A/B tested, except out of the box, in providing a side by side comparison of muliple different models to compare and contract performance. Utilizing the field of Systems Identification, dynamical systems models can be used to "online learn" by providing a feedback loop to generative system mechanisms.
The flexibility of cadCAD also enables the embedding of machine learning models into behavior policies or mechanisms for complex systems with an machine learning prediction component.
Examples
System Dynamics (SD)
System Dynamics is a modeling paradigm used to model the nonlinear behavior of complex systems using flows, stocks, and feedback loops. Systems Dynamics modeling is very useful in modeling population flows, financial statements, etc but has a limited ability to represent complex agent and system interactions.
Predator Prey model formulation
An example model for understanding dynamical system is the commonly used Lotka–Volterra Prey-Predator model, which is a pair of first order nonlienar differentional equations that is used to describe the dynamics of two species interating, one which is a predator the other which is the prey. We can model the population changes over time.
It is based on the following[2,3]
\begin{aligned}{\frac {dx}{dt}}&=\alpha x-\beta xy,\\{\frac {dy}{dt}}&=\delta xy-\gamma y,\end{aligned}
Where:
The most prominent feature of it is the existence, depending on the choice of parameters, of a repeatable cycle around a fixed point which creates a dynamical equilibrium between the number of preys and predators on a system.
System Dynamics paradigm (macroscopic view) advantages
Agent Based Modeling (ABM)
Agent based modeling is a modeling paradigm to simulate the interaction of autonoumous agents and their results on the underlying system. An example of Agent Based Modeling is modeling secondary market behavior of individual actors, such as traders, long-term investors, and liquidity providers.
Using the same Predator Prey model defined above in the Systems Dynamics Example, we'll adopt a model based on a grid world, on which preys and predators take the following actions at each timestep of their lifes:
There is an inherent stochastic nature on this model, and every time that you run it, we'll have a completely different result for the same parameters. But we can see that there is sort of a random equilibrium that converges to the dynamical equilibrium which we presented on the dynamical simulation.
Agent-based modeling paradigm (microscopic view) advantages
Networked Models
Grassroots Economics has created a Community Currency to help alleviate the liqudity crisis of rural Kenya. BlockScience created a graph based dynamical system model in order to provide a scaffold for Grassroot's economy planning, a subset of which is discussed below as an illustration of networked model types.
For networked, graph models evolving over time, assuming we have a directed graph \(\mathcal{G}(\mathcal{V},\mathcal{E})\) with subpopulations as vertices or nodes, \(\mathcal{V} = \{1...\mathcal{V}\}\) and edges as \(\mathcal{E} \subseteq \mathcal{V} \times \mathcal{V}\). Demand, utility, and spend are edges connecting the subpopulations, with spend used to denote desired flow between agents, as \(i,j \in \mathcal{E}\). Techically, the graph is a weighted, directed multigraph with more than on edge, \(i \longrightarrow j\) for any pair of vertices \(i,j \in \mathcal{V}\) with \(w_{i,j}\). In this example, we have a state update block, as shown below, with two partial state update blocks, choose_agents and spend_allocation.
In this example, during the spend_allocation, we calculate, based off of the desired interacting agents's demand, utility, and liquidity constraints, we iterate through the desired demand and allocate based on a stack ranking of utility \(v_{i,j}\) over demand \(\frac{v_{i,j}}{d_{i,j}}\) until all demand for each agent is met or the agent \(i\) runs out of funds. There are several assertions we may want to test, such as:
Networked Models Advantages
Multiscale Modeling
Multiscale Modeling is a type of modeling over multiple scales of time or space to describe a system, or spatio-temporal scales. An example of a multiscale model is the Conviction Voting, a a novel decision making process where votes express their preference for which proposals they would like to see approved in a continuous rather than discrete way. The longer the community keeps a preference on an individual proposal, the “stronger” the proposal conviction becomes. In the conviction voting model a graph structure is used to record the the introduction and removal of participants, candidates, proposals, and their outcomes. The complexity and different scales represented that cadCAD is able to model.
Multiscale Modeling Advantages
Glossary
This section contains terms and definitions
Table
Term/Concept, Math notation, Definition/description
carefully define some extra terms
need to work on a breakout on "time" representations
Basic Definitions
triggering a state update\(^\dagger\) The notation \(\wp(\mathcal{S})\) denotes the power set of the set \(\mathcal{S}\).
\(^\ddagger\) The notation \(\mathcal{V}\) denotes the universal set (set of all sets or set of all possible elements in a given context/universe? need citation)$.
Basic Definitions, an Example: King on Chess Board
Suppose a system comprised of a King moving on an empty chess board. The chess board is 8x8 squares, and the king can move one square in any direction (horizontally, vertically, or diagonally).
Chaining Partial State-Update Blocks
Defining and Enforcing Domain Restrictions
+invariants, other more advanced stuff eg \(V\), \(A\), \(a\), \(\mathcal{X}^C\)
+fixed points and neighborhoods, design for convergence properties (eg estimation,sensemaking)
+games, composed games, and path planning problems
References