rebased master
This commit is contained in:
parent
92559494d3
commit
a2453e8adf
73
README.md
73
README.md
|
|
@ -1,10 +1,10 @@
|
||||||
# SimCad
|
# cadCAD
|
||||||
**Warning**:
|
**Warning**:
|
||||||
**Do not** publish this package / software to **any** software repository **except** one permitted by BlockScience.
|
**Do not** publish this package / software to **any** software repository **except** one permitted by BlockScience.
|
||||||
|
|
||||||
**Description:**
|
**Description:**
|
||||||
|
|
||||||
SimCAD is a differential games based simulation software package for research, validation, and Computer \
|
cadCAD is a differential games based simulation software package for research, validation, and Computer \
|
||||||
Aided Design of economic systems. An economic system is treated as a state based model and defined through a \
|
Aided Design of economic systems. An economic system is treated as a state based model and defined through a \
|
||||||
set of endogenous and exogenous state variables which are updated through mechanisms and environmental \
|
set of endogenous and exogenous state variables which are updated through mechanisms and environmental \
|
||||||
processes, respectively. Behavioral models, which may be deterministic or stochastic, provide the evolution of \
|
processes, respectively. Behavioral models, which may be deterministic or stochastic, provide the evolution of \
|
||||||
|
|
@ -41,48 +41,89 @@ Intructions:
|
||||||
Examples:
|
Examples:
|
||||||
`/simulations/validation/*`
|
`/simulations/validation/*`
|
||||||
|
|
||||||
**3. Import SimCAD & Run Simulation:**
|
**3. Import cadCAD & Run Simulations:**
|
||||||
|
|
||||||
Examples: `/simulations/example_run.py` or `/simulations/example_run.ipynb`
|
Examples: `/simulations/*.py` or `/simulations/*.ipynb`
|
||||||
|
|
||||||
`/simulations/example_run.py`:
|
Single Simulation Run: `/simulations/single_config_run.py`
|
||||||
```python
|
```python
|
||||||
import pandas as pd
|
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
# The following imports NEED to be in the exact order
|
# The following imports NEED to be in the exact order
|
||||||
from SimCAD.engine import ExecutionMode, ExecutionContext, Executor
|
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
|
||||||
from validation import config1, config2
|
from simulations.validation import config1
|
||||||
from SimCAD import configs
|
from cadCAD import configs
|
||||||
|
|
||||||
exec_mode = ExecutionMode()
|
exec_mode = ExecutionMode()
|
||||||
|
|
||||||
print("Simulation Execution 1")
|
print("Simulation Execution: Single Configuration")
|
||||||
print()
|
print()
|
||||||
first_config = [configs[0]] # from config1
|
first_config = configs # only contains config1
|
||||||
single_proc_ctx = ExecutionContext(context=exec_mode.single_proc)
|
single_proc_ctx = ExecutionContext(context=exec_mode.single_proc)
|
||||||
run1 = Executor(exec_context=single_proc_ctx, configs=first_config)
|
run1 = Executor(exec_context=single_proc_ctx, configs=first_config)
|
||||||
run1_raw_result, tensor_field = run1.main()
|
run1_raw_result, tensor_field = run1.main()
|
||||||
result = pd.DataFrame(run1_raw_result)
|
result = pd.DataFrame(run1_raw_result)
|
||||||
print()
|
print()
|
||||||
print("Tensor Field:")
|
print("Tensor Field: config1")
|
||||||
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
|
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
|
||||||
print("Output:")
|
print("Output:")
|
||||||
print(tabulate(result, headers='keys', tablefmt='psql'))
|
print(tabulate(result, headers='keys', tablefmt='psql'))
|
||||||
print()
|
print()
|
||||||
|
```
|
||||||
|
|
||||||
print("Simulation Execution 2: Pairwise Execution")
|
Parameter Sweep Simulation Run (Concurrent): `/simulations/param_sweep_run.py`
|
||||||
print()
|
```python
|
||||||
|
import pandas as pd
|
||||||
|
from tabulate import tabulate
|
||||||
|
# The following imports NEED to be in the exact order
|
||||||
|
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
|
||||||
|
from simulations.validation import sweep_config
|
||||||
|
from cadCAD import configs
|
||||||
|
|
||||||
|
exec_mode = ExecutionMode()
|
||||||
|
|
||||||
|
print("Simulation Execution: Concurrent Execution")
|
||||||
multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)
|
multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)
|
||||||
run2 = Executor(exec_context=multi_proc_ctx, configs=configs)
|
run2 = Executor(exec_context=multi_proc_ctx, configs=configs)
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
config_names = ['sweep_config_A', 'sweep_config_B']
|
||||||
for raw_result, tensor_field in run2.main():
|
for raw_result, tensor_field in run2.main():
|
||||||
result = pd.DataFrame(raw_result)
|
result = pd.DataFrame(raw_result)
|
||||||
print()
|
print()
|
||||||
print("Tensor Field:")
|
print("Tensor Field: " + config_names[i])
|
||||||
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
|
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
|
||||||
print("Output:")
|
print("Output:")
|
||||||
print(tabulate(result, headers='keys', tablefmt='psql'))
|
print(tabulate(result, headers='keys', tablefmt='psql'))
|
||||||
print()
|
print()
|
||||||
|
i += 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Multiple Simulation Runs (Concurrent): `/simulations/multi_config run.py`
|
||||||
|
```python
|
||||||
|
import pandas as pd
|
||||||
|
from tabulate import tabulate
|
||||||
|
# The following imports NEED to be in the exact order
|
||||||
|
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
|
||||||
|
from simulations.validation import config1, config2
|
||||||
|
from cadCAD import configs
|
||||||
|
|
||||||
|
exec_mode = ExecutionMode()
|
||||||
|
|
||||||
|
print("Simulation Execution: Concurrent Execution")
|
||||||
|
multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)
|
||||||
|
run2 = Executor(exec_context=multi_proc_ctx, configs=configs)
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
config_names = ['config1', 'config2']
|
||||||
|
for raw_result, tensor_field in run2.main():
|
||||||
|
result = pd.DataFrame(raw_result)
|
||||||
|
print()
|
||||||
|
print("Tensor Field: " + config_names[i])
|
||||||
|
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
|
||||||
|
print("Output:")
|
||||||
|
print(tabulate(result, headers='keys', tablefmt='psql'))
|
||||||
|
print()
|
||||||
|
i =+ 1
|
||||||
```
|
```
|
||||||
|
|
||||||
The above can be run in Jupyter.
|
The above can be run in Jupyter.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue