Skip to content

Commit f9af9f3

Browse files
committed
Reload notebooks
1 parent e96f7c9 commit f9af9f3

10 files changed

+200
-71
lines changed

README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,145 @@ The following repository is a template for use in constructing MSML specs. The c
44

55
## The Dummy Model
66

7+
- The dummy model is meant to show the very basics of functionality but does not have any actual real world use, nonetheless, we will review the components
8+
- The high level idea is that the wirings append different letters to a dummy state the carries an overall string produced over time
9+
- The following are the wiring diagrams of the three wirings which we will then walk through the components of:
10+
11+
```mermaid
12+
graph TB
13+
14+
subgraph SVS["State Variables"]
15+
EE0[("DUMMY Entity")]
16+
EE1[("Global")]
17+
EES0(["Total Length"])
18+
EES0 --- EE0
19+
EES1(["Words"])
20+
EES1 --- EE0
21+
EES2(["Simulation Log"])
22+
EES2 --- EE1
23+
EES3(["Time"])
24+
EES3 --- EE1
25+
end
26+
27+
subgraph X9["DUMMY Control Wiring"]
28+
direction TB
29+
X1["DUMMY Length-1 DEF Control Action"]
30+
X2["DUMMY Letter Count Policy"]
31+
subgraph X7["DUMMY State Update Mechanisms"]
32+
direction TB
33+
X3["DUMMY Update Dummy Entity Mechanism"]
34+
X3 --> EES1
35+
X3 --> EES0
36+
X4["DUMMY Increment Time Mechanism"]
37+
X4 --> EES3
38+
X5[Domain]
39+
40+
direction LR
41+
direction TB
42+
X5 --"DUMMY String Length Space"--> X3
43+
X5 --> X4
44+
end
45+
X8["DUMMY Log Simulation Data Mechanism"]
46+
X8 --> EES2
47+
X1--"DUMMY ABCDEF Space"--->X2
48+
X2-."DUMMY String Length Space"..->X7
49+
X7--->X8
50+
end
51+
```
52+
53+
```mermaid
54+
graph TB
55+
56+
subgraph SVS["State Variables"]
57+
EE0[("DUMMY Entity")]
58+
EE1[("Global")]
59+
EES0(["Total Length"])
60+
EES0 --- EE0
61+
EES1(["Words"])
62+
EES1 --- EE0
63+
EES2(["Simulation Log"])
64+
EES2 --- EE1
65+
EES3(["Time"])
66+
EES3 --- EE1
67+
end
68+
69+
subgraph X9["DUMMY Length-1 Boundary Wiring"]
70+
direction TB
71+
X1["DUMMY Length-1 ABC Boundary Action"]
72+
X2["DUMMY Letter Count Policy"]
73+
subgraph X7["DUMMY State Update Mechanisms"]
74+
direction TB
75+
X3["DUMMY Update Dummy Entity Mechanism"]
76+
X3 --> EES1
77+
X3 --> EES0
78+
X4["DUMMY Increment Time Mechanism"]
79+
X4 --> EES3
80+
X5[Domain]
81+
82+
direction LR
83+
direction TB
84+
X5 --"DUMMY String Length Space"--> X3
85+
X5 --> X4
86+
end
87+
X8["DUMMY Log Simulation Data Mechanism"]
88+
X8 --> EES2
89+
X1--"DUMMY ABCDEF Space"--->X2
90+
X2--"DUMMY String Length Space"--->X7
91+
X7--->X8
92+
end
93+
```
94+
95+
```mermaid
96+
graph TB
97+
98+
subgraph SVS["State Variables"]
99+
EE0[("DUMMY Entity")]
100+
EE1[("Global")]
101+
EES0(["Total Length"])
102+
EES0 --- EE0
103+
EES1(["Words"])
104+
EES1 --- EE0
105+
EES2(["Simulation Log"])
106+
EES2 --- EE1
107+
EES3(["Time"])
108+
EES3 --- EE1
109+
end
110+
111+
subgraph X9["DUMMY Length-2 Boundary Wiring"]
112+
direction TB
113+
X1["DUMMY Length-2 ABC Combo Boundary Action"]
114+
X2["DUMMY Letter Count Policy"]
115+
subgraph X7["DUMMY State Update Mechanisms"]
116+
direction TB
117+
X3["DUMMY Update Dummy Entity Mechanism"]
118+
X3 --> EES1
119+
X3 --> EES0
120+
X4["DUMMY Increment Time Mechanism"]
121+
X4 --> EES3
122+
X5[Domain]
123+
124+
direction LR
125+
direction TB
126+
X5 --"DUMMY String Length Space"--> X3
127+
X5 --> X4
128+
end
129+
X8["DUMMY Log Simulation Data Mechanism"]
130+
X8 --> EES2
131+
X1--"DUMMY ABCDEF Space"--->X2
132+
X2--"DUMMY String Length Space"--->X7
133+
X7--->X8
134+
end
135+
```
136+
137+
- The components are defined as the following:
138+
- DUMMY Length-1 ABC Boundary Action: Creates a new string to add with length 1 which is either A, B, or C
139+
- DUMMY Length-2 ABC Combo Boundary Action: Creates a new string to add with length 2 which are combinations of A, B, C
140+
- DUMMY Length-1 DEF Control Action: Creates a new string of length 1 with either D, E, or F as the value
141+
- DUMMY Letter Count Policy: The policy which determines the length which equals the string length multiplied by a parameter for amplification of length (this is just to display how parameters work, it wouldn't make sense in the real world)
142+
- DUMMY Update Dummy Entity Mechanism: Mechanism for updating the dummy local state
143+
- DUMMY Increment Time Mechanism: Mechanism for updating the global time
144+
- DUMMY Log Simulation Data Mechanism: Mechanism for appending to the simulation log the current results
145+
7146
## SRC Folder
8147
- All the components in here with the exception of implementations/type mappings are JSON style components that get read into the MSML library for building the specification
9148
- The MSML documentation details what each type of component is

model/boundary_actions.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
from .spaces import EmptySpace, DUMMYABCDEFSpace
22

3+
def dummy_length-1_abc_boundary_action(state, params) -> (DUMMYABCDEFSpace):
34

4-
def dummy_length_1_abc_boundary_action(state, params) -> DUMMYABCDEFSpace:
5-
pass
5+
def dummy_length-2_abc_combo_boundary_action(state, params) -> (DUMMYABCDEFSpace):
66

7-
8-
def dummy_length_2_abc_combo_boundary_action(state, params) -> DUMMYABCDEFSpace:
9-
pass

model/states.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .types import EntityType, DummyABCDEFType, SimulationLogType, DummyIntegerType
1+
from .types import SimulationLogType, EntityType, DummyABCDEFType, DummyIntegerType
22
from typing import TypedDict
33

44
DUMMYState = TypedDict('DUMMY State', {'Words': DummyABCDEFType, 'Total Length': DummyIntegerType})

notebooks/Build Obsidian.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"sys.path.append(os.path.abspath('..'))\n",
2727
"\n",
2828
"\n",
29-
"#from math_spec_mapping import load_from_json, write_all_markdown_reports, write_spec_tree, write_overview\n",
29+
"from math_spec_mapping import load_from_json, write_all_markdown_reports, write_spec_tree, write_overview\n",
3030
"\n",
31-
"# For development purposes\n",
31+
"\"\"\"# For development purposes\n",
3232
"sys.path.append(os.path.abspath('../..'))\n",
33-
"from MSML.src.math_spec_mapping import (load_from_json, write_all_markdown_reports, write_spec_tree, write_overview)\n",
33+
"from MSML.src.math_spec_mapping import (load_from_json, write_all_markdown_reports, write_spec_tree, write_overview)\"\"\"\n",
3434
"\n",
3535
"from src import math_spec_json\n",
3636
"from copy import deepcopy\n",

notebooks/Experiment Simulations.ipynb

Lines changed: 23 additions & 23 deletions
Large diffs are not rendered by default.

notebooks/Implementation Playground.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"\n",
2222
"from simulation import params_base, state_base, compute_starting_total_length, check_d_probability\n",
2323
"\n",
24-
"#from math_spec_mapping import load_from_json\n",
24+
"from math_spec_mapping import load_from_json\n",
2525
"\n",
26-
"# For development purposes\n",
26+
"\"\"\"# For development purposes\n",
2727
"sys.path.append(os.path.abspath('../..'))\n",
28-
"from MSML.src.math_spec_mapping import (load_from_json)\n",
28+
"from MSML.src.math_spec_mapping import (load_from_json)\"\"\"\n",
2929
"\n",
3030
"from copy import deepcopy\n",
3131
"from src import math_spec_json\n",
@@ -54,7 +54,7 @@
5454
"name": "stdout",
5555
"output_type": "stream",
5656
"text": [
57-
"[{'string': 'D'}]\n"
57+
"[{'string': 'E'}]\n"
5858
]
5959
}
6060
],
@@ -106,7 +106,7 @@
106106
"name": "stdout",
107107
"output_type": "stream",
108108
"text": [
109-
"[{'string': 'E', 'unique_length': 1, 'length': 3}]\n"
109+
"[{'string': 'D', 'unique_length': 1, 'length': 3}]\n"
110110
]
111111
}
112112
],
@@ -134,10 +134,10 @@
134134
"output_type": "stream",
135135
"text": [
136136
"State Before:\n",
137-
"{'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x13779ade0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x13779b060>}}\n",
137+
"{'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x136f745e0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x136f74860>}}\n",
138138
"\n",
139139
"State After:\n",
140-
"{'Dummy': {'Words': 'F', 'Total Length': 3}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x13779ade0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x13779b060>}}\n"
140+
"{'Dummy': {'Words': 'F', 'Total Length': 3}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x136f745e0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x136f74860>}}\n"
141141
]
142142
}
143143
],
@@ -212,10 +212,10 @@
212212
"output_type": "stream",
213213
"text": [
214214
"State Before:\n",
215-
"{'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x13779ade0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x13779b060>}}\n",
215+
"{'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x136f745e0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x136f74860>}}\n",
216216
"\n",
217217
"State After:\n",
218-
"{'Dummy': {'Words': 'E', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [{'Time': 1, 'Word': 'E', 'Length (Multiplied)': 3}], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x13779ade0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x13779b060>}}\n"
218+
"{'Dummy': {'Words': 'E', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [{'Time': 1, 'Word': 'E', 'Length (Multiplied)': 3}], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x136f745e0>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x136f74860>}}\n"
219219
]
220220
}
221221
],

notebooks/Metaprogramming.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 2,
14+
"execution_count": 1,
1515
"metadata": {},
1616
"outputs": [],
1717
"source": [
@@ -21,11 +21,11 @@
2121
"sys.path.append(os.path.abspath('..'))\n",
2222
"\n",
2323
"\n",
24-
"#from math_spec_mapping import load_from_json, write_all_markdown_reports, write_spec_tree, write_overview\n",
24+
"from math_spec_mapping import load_from_json\n",
2525
"\n",
26-
"# For development purposes\n",
26+
"\"\"\"# For development purposes\n",
2727
"sys.path.append(os.path.abspath('../..'))\n",
28-
"from MSML.src.math_spec_mapping import (load_from_json, write_all_markdown_reports, write_spec_tree, write_overview)\n",
28+
"from MSML.src.math_spec_mapping import (load_from_json)\"\"\"\n",
2929
"\n",
3030
"from src import math_spec_json\n",
3131
"from copy import deepcopy\n",

notebooks/Single Simulation.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"from simulation import (params_base, state_base, compute_starting_total_length, check_d_probability, post_processing_function,\n",
1616
" percent_ending_in_d_metric, average_d_count_metric, plot_length_single_simulation)\n",
1717
"\n",
18-
"#from math_spec_mapping import load_from_json\n",
18+
"from math_spec_mapping import load_from_json\n",
1919
"\n",
20-
"# For development purposes\n",
20+
"\"\"\"# For development purposes\n",
2121
"sys.path.append(os.path.abspath('../..'))\n",
22-
"from MSML.src.math_spec_mapping import (load_from_json)\n",
22+
"from MSML.src.math_spec_mapping import (load_from_json)\"\"\"\n",
2323
"\n",
2424
"from copy import deepcopy\n",
2525
"from src import math_spec_json\n",
@@ -67,14 +67,14 @@
6767
"text": [
6868
" Time Word Length (Multiplied) Length (Nominal) D Count\n",
6969
"0 0 AA 6 2.0 0\n",
70-
"1 1 AACB 12 4.0 0\n",
71-
"2 2 AACBB 15 5.0 0\n",
72-
"3 3 AACBBCC 21 7.0 0\n",
73-
"4 4 AACBBCCA 24 8.0 0\n",
70+
"1 1 AABA 12 4.0 0\n",
71+
"2 2 AABAB 15 5.0 0\n",
72+
"3 3 AABABCB 21 7.0 0\n",
73+
"4 4 AABABCBC 24 8.0 0\n",
7474
"\n",
7575
"\n",
76-
"Percent Ending in D 0.098039\n",
77-
"Average D Count 1.450980\n",
76+
"Percent Ending in D 0.117647\n",
77+
"Average D Count 1.823529\n",
7878
"dtype: float64\n"
7979
]
8080
}

tests/DUMMY Economic Test.ipynb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"from simulation import (params_test2, params_test1, state_test1, params_base, state_base, compute_starting_total_length, check_d_probability, post_processing_function,\n",
1616
" percent_ending_in_d_metric, average_d_count_metric, plot_length_single_simulation)\n",
1717
"\n",
18-
"#from math_spec_mapping import load_from_json\n",
18+
"from math_spec_mapping import load_from_json\n",
1919
"\n",
20-
"# For development purposes\n",
20+
"\"\"\"# For development purposes\n",
2121
"sys.path.append(os.path.abspath('../..'))\n",
22-
"from MSML.src.math_spec_mapping import (load_from_json)\n",
22+
"from MSML.src.math_spec_mapping import (load_from_json)\"\"\"\n",
2323
"\n",
2424
"from copy import deepcopy\n",
2525
"from src import math_spec_json\n",
@@ -88,7 +88,7 @@
8888
},
8989
{
9090
"cell_type": "code",
91-
"execution_count": 6,
91+
"execution_count": 4,
9292
"metadata": {},
9393
"outputs": [],
9494
"source": [
@@ -110,13 +110,6 @@
110110
"assert metrics.to_dict()['Average D Count'] >= 0 and metrics.to_dict()['Average D Count'] <= 50.5\n",
111111
"assert state[\"Time\"] == 100"
112112
]
113-
},
114-
{
115-
"cell_type": "code",
116-
"execution_count": null,
117-
"metadata": {},
118-
"outputs": [],
119-
"source": []
120113
}
121114
],
122115
"metadata": {

tests/DUMMY Wiring Test.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"\n",
2424
"from simulation import params_base, state_base, compute_starting_total_length, check_d_probability\n",
2525
"\n",
26-
"#from math_spec_mapping import load_from_json\n",
26+
"from math_spec_mapping import load_from_json\n",
2727
"\n",
28-
"# For development purposes\n",
28+
"\"\"\"# For development purposes\n",
2929
"sys.path.append(os.path.abspath('../..'))\n",
30-
"from MSML.src.math_spec_mapping import (load_from_json)\n",
30+
"from MSML.src.math_spec_mapping import (load_from_json)\"\"\"\n",
3131
"\n",
3232
"from copy import deepcopy\n",
3333
"from src import math_spec_json\n",
@@ -69,7 +69,7 @@
6969
"output_type": "stream",
7070
"text": [
7171
"Starting spaces: []\n",
72-
"Starting state: {'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a8b100>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a8b380>}}\n",
72+
"Starting state: {'Dummy': {'Words': '', 'Total Length': 0}, 'Time': 0, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a74540>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a747c0>}}\n",
7373
"\n",
7474
"\n",
7575
"Spaces after DUMMY Length-1 DEF Control Action: [{'string': 'D'}]\n",
@@ -79,11 +79,11 @@
7979
"\n",
8080
"\n",
8181
"Spaces after DUMMY State Update Mechanisms: []\n",
82-
"State after DUMMY State Update Mechanisms: {'Dummy': {'Words': 'D', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a8b100>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a8b380>}}\n",
82+
"State after DUMMY State Update Mechanisms: {'Dummy': {'Words': 'D', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a74540>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a747c0>}}\n",
8383
"\n",
8484
"\n",
8585
"Spaces after DUMMY Log Simulation Data Mechanism: None\n",
86-
"State after DUMMY Log Simulation Data Mechanism: {'Dummy': {'Words': 'D', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [{'Time': 1, 'Word': 'D', 'Length (Multiplied)': 3}], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a8b100>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a8b380>}}\n",
86+
"State after DUMMY Log Simulation Data Mechanism: {'Dummy': {'Words': 'D', 'Total Length': 3}, 'Time': 1, 'Simulation Log': [{'Time': 1, 'Word': 'D', 'Length (Multiplied)': 3}], 'Stateful Metrics': {'DUMMY Nominal Length Stateful Metric': <function dummy_metric at 0x135a74540>}, 'Metrics': {'DUMMY Multiplied Length Metric': <function dummy_multiplied_length_metric at 0x135a747c0>}}\n",
8787
"\n",
8888
"\n"
8989
]

0 commit comments

Comments
 (0)