Compare commits

...

40 Commits

Author SHA1 Message Date
Markus Buhatem Koch f5ca0857f3
Merge pull request #76 from BlockScience/staging
Update README.md
2019-10-02 15:22:25 -03:00
Markus Buhatem Koch d9ff2997a1
Update README.md
`System Model Configuration` is now the base MD in the documentation folder
2019-10-02 15:22:02 -03:00
Joshua E. Jodesty ddabdbb381
Merge pull request #75 from BlockScience/staging
Returning Build From Source and Made documentation prominent
2019-09-26 15:05:48 -04:00
Joshua E. Jodesty 17316277ff
Merge pull request #74 from JEJodesty/staging
Staging
2019-09-26 15:02:15 -04:00
Joshua E. Jodesty c326f3c8c0 docs 2019-09-26 14:57:00 -04:00
Joshua E. Jodesty 422b0fb671 documentation & build from source is important for contributors 2019-09-26 09:16:20 -04:00
Joshua E. Jodesty 319f74a89c documentation is important for contributors . . . 2019-09-24 20:22:01 -04:00
Joshua E. Jodesty 154a653c7f
Merge pull request #73 from BlockScience/staging
deploying 0.3.1
2019-09-21 11:05:42 -04:00
Markus Buhatem Koch 3683aa30dc
Merge pull request #72 from markusbkoch/master
Update README
2019-09-19 22:46:42 -03:00
Markus Buhatem Koch 837aad310e
Update README.md 2019-09-19 22:33:54 -03:00
Markus Buhatem Koch 4e5dca0cf9
Rename Simulation_Configuration.md to README.md 2019-09-19 22:33:06 -03:00
Markus Buhatem Koch 4fe3419b23
Update README.md 2019-09-19 22:32:40 -03:00
Joshua E. Jodesty 7c870e584b
Merge pull request #71 from JEJodesty/staging
Merging dist containing tp.clear()
2019-09-16 23:21:21 -04:00
Joshua E. Jodesty b515dd3fdb new dist 2019-09-16 23:18:10 -04:00
Joshua E. Jodesty 5048976f71
Merge pull request #69 from markusbkoch/markusbkoch-patch-1
merge setup.py update
2019-09-16 23:08:50 -04:00
Markus Buhatem Koch 4e1f730c27
update version number 2019-09-11 17:20:33 -03:00
Markus Buhatem Koch 9f96821b89
add dependencies to setup.py
so that pypi installs dependencies automatically (https://packaging.python.org/discussions/install-requires-vs-requirements/)
2019-09-11 17:10:20 -03:00
Markus Buhatem Koch 460b1ff67c
Merge pull request #1 from BlockScience/master
merge
2019-09-11 22:03:02 +02:00
Joshua E. Jodesty b8fa090222
Merge pull request #68 from BlockScience/staging
contribution draft rename
2019-09-07 20:57:38 -04:00
Joshua E. Jodesty 01285e6320
Merge pull request #67 from JEJodesty/master
contribution draft rename
2019-09-07 20:56:48 -04:00
Joshua E. Jodesty d3ef3d23f5 contribution draft 2019-09-07 20:55:48 -04:00
Joshua E. Jodesty ee8b3de331
Merge pull request #66 from BlockScience/staging
contributing.md
2019-09-07 20:53:30 -04:00
Joshua E. Jodesty ce3eacd971
Merge pull request #65 from JEJodesty/master
contributing.md
2019-09-07 20:52:17 -04:00
Joshua E. Jodesty 86e683b268 contribution draft 2019-09-07 20:50:48 -04:00
Joshua E. Jodesty a2346046f3 contribution draft 2019-09-07 20:48:51 -04:00
Joshua E. Jodesty 0619764aef
Merge pull request #64 from BlockScience/staging
Staging
2019-09-07 19:55:33 -04:00
Joshua E. Jodesty faae27f21e
Merge pull request #63 from JEJodesty/master
Open Source cadCAD 0.3.0!!!!!!
2019-09-07 19:54:38 -04:00
Joshua E. Jodesty dd872c3878 open sourced 0.3.0 2019-09-07 19:50:48 -04:00
Joshua E. Jodesty 130f85f0ef
Merge pull request #62 from JEJodesty/master
Hell
2019-09-07 19:31:42 -04:00
Joshua E. Jodesty bc4ab3113d behind gates of hell pt. 1 2019-09-07 19:30:06 -04:00
Joshua E. Jodesty c57e2d9840 behind gates of hell 2019-09-07 19:28:44 -04:00
Joshua E. Jodesty 81d666ce3e hell gates pt. 7 2019-09-07 19:27:20 -04:00
Joshua E. Jodesty f00b14d52e
Merge pull request #61 from BlockScience/staging
Update Description
2019-09-07 19:07:28 -04:00
Joshua E. Jodesty 5d0b1c4aec
Merge pull request #60 from JEJodesty/staging
Update Description
2019-09-07 19:05:47 -04:00
Joshua E. Jodesty 9a12b5d0d6
Merge pull request #58 from JEJodesty/staging
Staging
2019-09-05 16:18:18 -04:00
Markus Buhatem Koch f931945eaf
Merge pull request #57 from BlockScience/staging
add link to readme
2019-08-28 09:13:56 -03:00
Markus Buhatem Koch d56b5c1c5f
Merge pull request #56 from BlockScience/staging
Tutorial part 6
2019-08-28 09:12:18 -03:00
Joshua E. Jodesty 4f58a169c5
Merge pull request #55 from BlockScience/staging
restart threads
2019-08-27 15:28:54 -04:00
Joshua E. Jodesty de9a708d43
Merge pull request #54 from BlockScience/staging
Open Sourcing cadCad Pt. 2
2019-08-22 19:57:37 -04:00
Joshua E. Jodesty f9996163d0
Merge pull request #53 from BlockScience/staging
Open Sourcing cadCAD!!!!
2019-08-22 18:29:47 -04:00
7 changed files with 68 additions and 163 deletions

21
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,21 @@
# Contributing to cadCAD (Draft)
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
The following is a set of guidelines for contributing to cadCAD. These are mostly guidelines, not rules.
Use your best judgment, and feel free to propose changes to this document in a pull request.
### Pull Requests:
Pull Request (PR) presented as "->".
General Template:
fork/branch -> BlockScience/staging
Contributing a new feature:
fork/feature -> BlockScience/staging
Contributing to an existing feature:
fork/feature -> BlockScience/feature
Thanks! :heart:

195
README.md
View File

@ -1,173 +1,50 @@
```
__________ ____
__________ ____
________ __ _____/ ____/ | / __ \
/ ___/ __` / __ / / / /| | / / / /
/ /__/ /_/ / /_/ / /___/ ___ |/ /_/ /
\___/\__,_/\__,_/\____/_/ |_/_____/
/ /__/ /_/ / /_/ / /___/ ___ |/ /_/ /
\___/\__,_/\__,_/\____/_/ |_/_____/
by BlockScience
======================================
Complex Adaptive Dynamics
o i e
m d s
p e i
u d g
t n
e
r
```
***cadCAD*** is a Python package that assists in the processes of designing, testing and validating complex systems through simulation, with support for Monte Carlo methods, A/B testing and parameter sweeping.
# Getting Started
## 1. Installation:
Requires [Python 3](https://www.python.org/downloads/)
**Option A: Install Using [pip](https://pypi.org/project/cadCAD/)**
```bash
pip3 install cadCAD
```
**Introduction:**
***cadCAD*** is a Python library that assists in the processes of designing, testing and validating complex systems through
simulation. At its core, cadCAD is a differential games engine that supports parameter sweeping and Monte Carlo analyses
and can be easily integrated with other scientific computing Python modules and data science workflows.
**Description:**
cadCAD (complex adaptive systems computer-aided design) is a python based, unified modeling framework for stochastic
dynamical systems and differential games for research, validation, and Computer Aided Design of economic systems created
by BlockScience. It is capable of modeling systems at all levels of abstraction from Agent Based Modeling (ABM) to
System Dynamics (SD), and enabling smooth integration of computational social science simulations with empirical data
science workflows.
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 processes, respectively. Behavioral models, which may
be deterministic or stochastic, provide the evolution of the system within the action space of the mechanisms.
Mathematical formulations of these economic games treat agent utility as derived from the state rather than direct from
an action, creating a rich, dynamic modeling framework. Simulations may be run with a range of initial conditions and
parameters for states, behaviors, mechanisms, and environmental processes to understand and visualize network behavior
under various conditions. Support for A/B testing policies, Monte Carlo analysis, and other common numerical methods is
provided.
For example, cadCAD tool allows us to represent a companys or communitys current business model along with a desired
future state and helps make informed, rigorously tested decisions on how to get from todays stage to the future state.
It allows us to use code to solidify our conceptualized ideas and see if the outcome meets our expectations. We can
iteratively refine our work until we have constructed a model that closely reflects reality at the start of the model,
and see how it evolves. We can then use these results to inform business decisions.
#### Documentation:
* ##### [Tutorials](tutorials)
* ##### [System Model Configuration](documentation/Simulation_Configuration.md)
* ##### [System Simulation Execution](documentation/Simulation_Execution.md)
* ##### [Policy Aggregation](documentation/Policy_Aggregation.md)
* ##### [System Model Parameter Sweep](documentation/System_Model_Parameter_Sweep.md)
#### 0. Installation:
**Python 3.6.5** :: Anaconda, Inc.
**Option A:** Build From Source
```bash
**Option B:** Build From Source
```
pip3 install -r requirements.txt
python3 setup.py sdist bdist_wheel
pip3 install dist/*.whl
```
**Option B:** Proprietary Build Access
## 2. Learn the basics
**Tutorials:** available both as [Jupyter Notebooks](tutorials)
and [videos](https://www.youtube.com/watch?v=uJEiYHRWA9g&list=PLmWm8ksQq4YKtdRV-SoinhV6LbQMgX1we)
***IMPORTANT NOTE:*** Tokens are issued to those with access to proprietary builds of cadCAD and BlockScience employees **ONLY**.
Replace \<TOKEN\> with an issued token in the script below.
```bash
pip3 install pandas pathos fn funcy tabulate
pip3 install cadCAD --extra-index-url https://<TOKEN>@repo.fury.io/blockscience/
```
Familiarize yourself with some system modelling concepts and cadCAD terminology.
## 3. Documentation:
* [System Model Configuration](documentation)
* [System Simulation Execution](documentation/Simulation_Execution.md)
* [Policy Aggregation](documentation/Policy_Aggregation.md)
* [System Model Parameter Sweep](documentation/System_Model_Parameter_Sweep.md)
#### 1. [Configure System Model](documentation/Simulation_Configuration.md)
#### 2. [Execute Simulations:](documentation/Simulation_Execution.md)
##### Single Process Execution:
Example System Model Configurations:
* [System Model A](documentation/examples/sys_model_A.py):
`/documentation/examples/sys_model_A.py`
* [System Model B](documentation/examples/sys_model_B.py):
`/documentation/examples/sys_model_B.py`
Example Simulation Executions:
* [System Model A](documentation/examples/sys_model_A_exec.py):
`/documentation/examples/sys_model_A_exec.py`
* [System Model B](documentation/examples/sys_model_B_exec.py):
`/documentation/examples/sys_model_B_exec.py`
```python
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
from documentation.examples import sys_model_A
from cadCAD import configs
exec_mode = ExecutionMode()
# Single Process Execution using a Single System Model Configuration:
# sys_model_A
sys_model_A = [configs[0]] # sys_model_A
single_proc_ctx = ExecutionContext(context=exec_mode.single_proc)
sys_model_A_simulation = Executor(exec_context=single_proc_ctx, configs=sys_model_A)
sys_model_A_raw_result, sys_model_A_tensor_field = sys_model_A_simulation.execute()
sys_model_A_result = pd.DataFrame(sys_model_A_raw_result)
print()
print("Tensor Field: sys_model_A")
print(tabulate(sys_model_A_tensor_field, headers='keys', tablefmt='psql'))
print("Result: System Events DataFrame")
print(tabulate(sys_model_A_result, headers='keys', tablefmt='psql'))
print()
```
##### Multiple Simulations (Concurrent):
###### Multiple Simulation Execution (Multi Process Execution)
System Model Configurations:
* [System Model A](documentation/examples/sys_model_A.py):
`/documentation/examples/sys_model_A.py`
* [System Model B](documentation/examples/sys_model_B.py):
`/documentation/examples/sys_model_B.py`
[Example Simulation Executions:](documentation/examples/sys_model_AB_exec.py)
`/documentation/examples/sys_model_AB_exec.py`
```python
import pandas as pd
from tabulate import tabulate
from cadCAD.engine import ExecutionMode, ExecutionContext, Executor
from documentation.examples import sys_model_A, sys_model_B
from cadCAD import configs
exec_mode = ExecutionMode()
# # Multiple Processes Execution using Multiple System Model Configurations:
# # sys_model_A & sys_model_B
multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)
sys_model_AB_simulation = Executor(exec_context=multi_proc_ctx, configs=configs)
i = 0
config_names = ['sys_model_A', 'sys_model_B']
for sys_model_AB_raw_result, sys_model_AB_tensor_field in sys_model_AB_simulation.execute():
sys_model_AB_result = pd.DataFrame(sys_model_AB_raw_result)
print()
print(f"Tensor Field: {config_names[i]}")
print(tabulate(sys_model_AB_tensor_field, headers='keys', tablefmt='psql'))
print("Result: System Events DataFrame:")
print(tabulate(sys_model_AB_result, headers='keys', tablefmt='psql'))
print()
i += 1
```
##### Parameter Sweep Simulation (Concurrent):
[Example:](documentation/examples/param_sweep.py)
`/documentation/examples/param_sweep.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 documentation.examples import param_sweep
from cadCAD import configs
exec_mode = ExecutionMode()
multi_proc_ctx = ExecutionContext(context=exec_mode.multi_proc)
run = Executor(exec_context=multi_proc_ctx, configs=configs)
for raw_result, tensor_field in run.execute():
result = pd.DataFrame(raw_result)
print()
print("Tensor Field:")
print(tabulate(tensor_field, headers='keys', tablefmt='psql'))
print("Output:")
print(tabulate(result, headers='keys', tablefmt='psql'))
print()
```
## 4. Connect
Find other cadCAD users at our [Discourse](https://community.cadcad.org/). We are a small but rapidly growing community.

Binary file not shown.

BIN
dist/cadCAD-0.3.1.tar.gz vendored Normal file

Binary file not shown.

View File

@ -7,7 +7,6 @@ by BlockScience. It is capable of modeling systems at all levels of abstraction
System Dynamics (SD), and enabling smooth integration of computational social science simulations with empirical data
science workflows.
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 processes, respectively. Behavioral models, which may
be deterministic or stochastic, provide the evolution of the system within the action space of the mechanisms.
@ -19,7 +18,7 @@ provided.
"""
setup(name='cadCAD',
version='0.3.0',
version='0.3.1',
description="cadCAD: a differential games based simulation software package for research, validation, and \
Computer Aided Design of economic systems",
long_description=long_description,
@ -27,5 +26,13 @@ setup(name='cadCAD',
author='Joshua E. Jodesty',
author_email='joshua@block.science, joshua.jodesty@gmail.com',
license='LICENSE.txt',
packages=find_packages()
)
packages=find_packages(),
install_requires=[
"pandas",
"wheel",
"pathos",
"fn",
"tabulate",
"funcy"
]
)