From ab3a9e370d91da4bdd93b6242f7515de0af1eb5d Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Mon, 7 Jan 2019 13:50:34 -0500 Subject: [PATCH 1/9] Initial commit --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bb71404 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# SimCAD-AZ \ No newline at end of file From cdcc20787170f9722013d61258e7f565ce46c7cc Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Mon, 7 Jan 2019 18:15:15 -0500 Subject: [PATCH 2/9] pre clean for az pt. 2.5 --- simulations/sim_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simulations/sim_test.py b/simulations/sim_test.py index ef1daa7..bb75134 100644 --- a/simulations/sim_test.py +++ b/simulations/sim_test.py @@ -18,7 +18,7 @@ single_proc_ctx = ExecutionContext(context=exec_mode.single_proc) run1 = Executor(exec_context=single_proc_ctx, configs=first_config) run1_raw_result, tensor_field = run1.main() result = pd.DataFrame(run1_raw_result) -# result.to_csv('~/Projects/DiffyQ-SimCAD/results/config4.csv', sep=',') +# result.to_csv('~/Projects/DiffyQ-SimCAD/results/config.csv', sep=',') print() print("Tensor Field:") print(tabulate(tensor_field, headers='keys', tablefmt='psql')) From 6bd54bd9d8c1a541f0fcd4823170766194099053 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Mon, 7 Jan 2019 20:27:30 -0500 Subject: [PATCH 3/9] LICENSE.txt --- LICENSE.txt | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..b5d9242 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,150 @@ +SOFTWARE LICENSE AGREEMENT + +This Software License Agreement (the “Agreement”) is entered into as of December __ 2018, (the “Effective Date”) between +Dapper Labs, Inc., a Canadian corporation having its principal place of business at 980-350 Howe Street, +Vancouver, BC V6Z 1N9 (“DLI”) and BlockScience, Inc., a California corporation with an address at 471 McAuley Street, +Oakland, CA 94609 (“BlockScience”). This Agreement includes the attached Exhibit A. + +WHEREAS, DLI and BlockScience are parties to that certain Professional Services Agreement dated March 23, 2018 (the +“PSA”), pursuant to which BlockScience performed and is currently performing professional services and other development +work for DLI; + +WHEREAS, as part of BlockScience’s performance under the PSA, BlockScience developed certain “behaviour archetypes” and +“configuration of the Null Model”, which the parties agree are “Work Product” under the PSA; + +WHEREAS, the parties agree that BlockScience’s proprietary SimCAD software tool is considered “Contractor Technology” +under the PSA; and + +WHEREAS, the parties wish to enter into this Agreement to clarify DLI’s rights to use the SimCAD software tool on a +going-forward basis. + +NOW, THEREFORE, for good and valuable consideration, the receipt and sufficiency of which is hereby acknowledged, DLI +and BlockScience agree as follows: + +1. DEFINITIONS + +(a) “Affiliate” means any entity that, directly or indirectly through one or more intermediaries, controls, is +controlled by, or is under common control with, DLI. + +(b) “Documentation” means any manuals, documentation and other supporting materials related to the Software. +Documentation is considered part of the related Software. + +(c) “Intellectual Property Rights” means patent rights (including patent applications and disclosures), copyrights, +trade marks, trade secrets, know-how and any other intellectual property rights recognized in any country or +jurisdiction in the world. + +(d) “Software” means the object and source code versions of BlockScience’s proprietary SimCAD software product more +fully described in Exhibit A. Software includes the applicable Documentation, as well as any Updates. + +(e) “Update” means any bug fix, error correction, patch, modification, enhancement, update, upgrade, replacement, +successor product, new version, new release, or derivative work of or to the Software. + +(f) “Zeus” means the decentralized synchronous computational network developed by DLI, as such name or reference may be +changed from time to time at DLI’s sole discretion. + +2. SOFTWARE LICENSE + +(a) License Grant. BlockScience hereby grants to DLI and its Affiliates a worldwide, non-exclusive, royalty-free, +irrevocable, perpetual license to (i) download, install, use, execute, access, copy, perform, and modify, the Software +in connection with the Zeus project; (ii) distribute and display the Software internally amongst DLI and its Affiliates, +its and their employees, contractors, and agents, subject to the use of reasonable efforts to maintain the confidential +status of the non-public aspects of the Software display; and (iii) create derivative works of the Software in +connection with the Zeus project, provided that any such derivative works may only be used in connection with the Zeus +project. For the sake of clarity, nothing in this Agreement (including, without limitation, this Section 2) will create +any liability to DLI for or restrict DLI’s ability to externally distribute python scripts containing the “input” +configuration files specific to the Zeus project, as well as the notebooks with the resulting “output” data from the +Software, all of which may be distributed, displayed, and shared publicly at DLI’s discretion. + +(b) Ownership; Limited Rights. As between the parties, BlockScience owns and retains all right, title and interest in +and to the Software, and all Intellectual Property Rights therein. DLI’s rights in the Software are limited to those +expressly granted in Section 2(a) and in the PSA. BlockScience reserves all rights and licenses in the Software not +expressly granted to DLI herein and in the PSA. + +(c) Delivery. BlockScience will deliver a copy of the Software and Documentation to DLI on the Effective Date. The +delivery may be made in electronic form, or via hardcopy medium (e.g., a CD). + +(d) Updates. BlockScience will deliver Updates to DLI as and when such Updates become available. The obligation to +deliver Updates will continue for as long as the PSA remains in force; upon termination or expiration of the PSA, +BlockScience’s obligation to provide Updates will automatically terminate. + +(e) Support. BlockScience will provide reasonable technical support for the Software, to help DLI manage any support +issues that arise. The obligation to provide support will continue for as long as the PSA remains in force; upon +termination or expiration of the PSA, BlockScience’s obligation to provide support will automatically terminate. + +3. NO FEES. + +There are no fees owed by DLI for the license granted or the Updates or support provided by BlockScience +pursuant to this Agreement. Each party will bear its own costs and expenses arising out of or relating to its +obligations, efforts and performance under this Agreement. + +4. LIMITED WARRANTY; DISCLAIMER + +(a) Limited Warranty. BlockScience represents and warrants as follows: (i) that it has the right to enter into this +Agreement, and to perform its obligations hereunder, without violating the terms of any other agreement; (ii) that the +Software, and any Updates, do not and will not infringe, violate, or misappropriate the Intellectual Property Rights of +any third party; (iii) that the Software and any Updates do not and will not contain any virus, malware, spyware, trojan +horse, or other malicious code; and (iv) that the Software and each Update will substantially conform to its +Documentation. + +(b) Disclaimer. EXCEPT AS OTHERWISE SET FORTH IN THIS AGREEMENT, BLOCKSCIENCE DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR +IMPLIED, RELATED TO THE SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. + +5. TERM & TERMINATION + +(a) Term. This Agreement begins on the Effective Date, and will continue in effect until one of us terminates it in +accordance with Section 5(b). + +(b) Termination for Breach. Either party may terminate this Agreement if the other party breaches any material term or +condition of this Agreement, and the breaching party fails to cure the breach within thirty (30) days of receiving +written notice of it. + +(c) Survival. Sections 2 through 7 will survive termination or expiration of this Agreement. + +6. INDEMNIFICATION. + +BlockScience will defend, indemnify, and hold DLI harmless from and against any claim, damage, loss, +liability, expense and cost (including, without limitation, reasonable attorneys’ fees) incurred by or brought against +DLI arising out of or related to: (i) any claim that the Software infringes or misappropriates the Intellectual Property +Rights of that third party; or (ii) BlockScience’s breach of its limited warranties in Section 4(a). + +7. GENERAL TERMS + +(a) Entire Agreement; Waiver. This Agreement is the entire understanding of the parties, and supersedes any and all +prior agreements or understandings between the parties as to its subject matter. It may be amended or modified, or +provisions waived, only in a writing signed by both parties. The waiver of a breach of any provision of this Agreement +will not operate or be interpreted as a waiver of any other or subsequent breach. + +(b) Acknowledgement. BlockScience acknowledges and agrees that the “behaviour archetypes” and “configuration of the Null +Model” referenced in the PSA are considered “Work Product” under the PSA. + +(c) Governing Law. This Agreement will be construed, interpreted and applies in accordance with the internal laws of +British Columbia, Canada (excluding its body of law controlling conflicts of law). Any legal action or proceeding +arising under or related to this Agreement will be brought exclusively in the federal or provincial courts located in +Vancouver, British Columbia, and the parties irrevocably consent to personal jurisdiction and venue there. + +(d) Severability. If any provision of this Agreement is held to be invalid or unenforceable for any reason, that +provision will be enforced to the maximum extent permitted by law, and the remaining provisions will continue in full +force and effect. + +(e) Miscellaneous. This Agreement may be executed in one or more counterparts, with the same effect as if the parties +had signed the same document. Each counterpart so executed will be deemed to be an original, and all such counterparts +will be construed together and will constitute one Agreement. The prevailing party in any action or legal proceeding +arising out of this Agreement will be entitled to recover from the other party all reasonable costs and expenses +incurred in connection with such action or proceeding, including reasonable attorneys’ fees and court costs. In the +event of a direct conflict between the terms of this Agreement and the PSA with respect to the DLI’s rights in and to +the Software, the terms of this Agreement will control. + +EXHIBIT A + +SOFTWARE + +Software Name: SimCAD tool + +Software Description: SimCAD is a Monte-Carlo 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 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. Simulations can 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. \ No newline at end of file From c8634c53312e838835d73215c92396e48ff574ff Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Mon, 7 Jan 2019 20:41:35 -0500 Subject: [PATCH 4/9] put back notebooks/test.ipynb --- notebooks/test.ipynb | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 notebooks/test.ipynb diff --git a/notebooks/test.ipynb b/notebooks/test.ipynb new file mode 100644 index 0000000..4814a4a --- /dev/null +++ b/notebooks/test.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Simulation Run 2: Pairwise Execution\")\n", + "print()\n", + "multi_proc_ctx = ExecutionContext(exec_mode.multi_proc)\n", + "run2 = Executor(multi_proc_ctx, configs)\n", + "run2_raw_results = run2.main()\n", + "for raw_result in run2_raw_results:\n", + " result = pd.DataFrame(raw_result)\n", + " print(tabulate(result, headers='keys', tablefmt='psql'))\n", + "print()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Simulation Run 1\")\n", + "print()\n", + "single_config = [configs[0]]\n", + "single_proc_ctx = ExecutionContext(exec_mode.single_proc)\n", + "run1 = Executor(single_proc_ctx, single_config)\n", + "run1_raw_result = run1.main()\n", + "result = pd.DataFrame(run1_raw_result)\n", + "result" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from tabulate import tabulate\n", + "\n", + "from SimCAD.engine import ExecutionMode, ExecutionContext, Executor\n", + "from sandboxUX import config1, config2\n", + "from SimCAD import configs\n", + "\n", + "# ToDo: pass ExecutionContext with execution method as ExecutionContext input\n", + "\n", + "exec_mode = ExecutionMode()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} From 0eeed616e0784073d517fd818d1206f101c96792 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Mon, 7 Jan 2019 20:42:42 -0500 Subject: [PATCH 5/9] put back notebooks/test.ipynb --- notebooks/test.ipynb | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 notebooks/test.ipynb diff --git a/notebooks/test.ipynb b/notebooks/test.ipynb new file mode 100644 index 0000000..4814a4a --- /dev/null +++ b/notebooks/test.ipynb @@ -0,0 +1,78 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Simulation Run 2: Pairwise Execution\")\n", + "print()\n", + "multi_proc_ctx = ExecutionContext(exec_mode.multi_proc)\n", + "run2 = Executor(multi_proc_ctx, configs)\n", + "run2_raw_results = run2.main()\n", + "for raw_result in run2_raw_results:\n", + " result = pd.DataFrame(raw_result)\n", + " print(tabulate(result, headers='keys', tablefmt='psql'))\n", + "print()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(\"Simulation Run 1\")\n", + "print()\n", + "single_config = [configs[0]]\n", + "single_proc_ctx = ExecutionContext(exec_mode.single_proc)\n", + "run1 = Executor(single_proc_ctx, single_config)\n", + "run1_raw_result = run1.main()\n", + "result = pd.DataFrame(run1_raw_result)\n", + "result" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from tabulate import tabulate\n", + "\n", + "from SimCAD.engine import ExecutionMode, ExecutionContext, Executor\n", + "from sandboxUX import config1, config2\n", + "from SimCAD import configs\n", + "\n", + "# ToDo: pass ExecutionContext with execution method as ExecutionContext input\n", + "\n", + "exec_mode = ExecutionMode()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} From 16fc3247732fa2b19ecc28eef95ee832b00e60e4 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Tue, 8 Jan 2019 18:59:27 -0500 Subject: [PATCH 6/9] removed LICENSE.txt --- LICENSE.txt | 150 ---------------------------------------------------- 1 file changed, 150 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index b5d9242..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,150 +0,0 @@ -SOFTWARE LICENSE AGREEMENT - -This Software License Agreement (the “Agreement”) is entered into as of December __ 2018, (the “Effective Date”) between -Dapper Labs, Inc., a Canadian corporation having its principal place of business at 980-350 Howe Street, -Vancouver, BC V6Z 1N9 (“DLI”) and BlockScience, Inc., a California corporation with an address at 471 McAuley Street, -Oakland, CA 94609 (“BlockScience”). This Agreement includes the attached Exhibit A. - -WHEREAS, DLI and BlockScience are parties to that certain Professional Services Agreement dated March 23, 2018 (the -“PSA”), pursuant to which BlockScience performed and is currently performing professional services and other development -work for DLI; - -WHEREAS, as part of BlockScience’s performance under the PSA, BlockScience developed certain “behaviour archetypes” and -“configuration of the Null Model”, which the parties agree are “Work Product” under the PSA; - -WHEREAS, the parties agree that BlockScience’s proprietary SimCAD software tool is considered “Contractor Technology” -under the PSA; and - -WHEREAS, the parties wish to enter into this Agreement to clarify DLI’s rights to use the SimCAD software tool on a -going-forward basis. - -NOW, THEREFORE, for good and valuable consideration, the receipt and sufficiency of which is hereby acknowledged, DLI -and BlockScience agree as follows: - -1. DEFINITIONS - -(a) “Affiliate” means any entity that, directly or indirectly through one or more intermediaries, controls, is -controlled by, or is under common control with, DLI. - -(b) “Documentation” means any manuals, documentation and other supporting materials related to the Software. -Documentation is considered part of the related Software. - -(c) “Intellectual Property Rights” means patent rights (including patent applications and disclosures), copyrights, -trade marks, trade secrets, know-how and any other intellectual property rights recognized in any country or -jurisdiction in the world. - -(d) “Software” means the object and source code versions of BlockScience’s proprietary SimCAD software product more -fully described in Exhibit A. Software includes the applicable Documentation, as well as any Updates. - -(e) “Update” means any bug fix, error correction, patch, modification, enhancement, update, upgrade, replacement, -successor product, new version, new release, or derivative work of or to the Software. - -(f) “Zeus” means the decentralized synchronous computational network developed by DLI, as such name or reference may be -changed from time to time at DLI’s sole discretion. - -2. SOFTWARE LICENSE - -(a) License Grant. BlockScience hereby grants to DLI and its Affiliates a worldwide, non-exclusive, royalty-free, -irrevocable, perpetual license to (i) download, install, use, execute, access, copy, perform, and modify, the Software -in connection with the Zeus project; (ii) distribute and display the Software internally amongst DLI and its Affiliates, -its and their employees, contractors, and agents, subject to the use of reasonable efforts to maintain the confidential -status of the non-public aspects of the Software display; and (iii) create derivative works of the Software in -connection with the Zeus project, provided that any such derivative works may only be used in connection with the Zeus -project. For the sake of clarity, nothing in this Agreement (including, without limitation, this Section 2) will create -any liability to DLI for or restrict DLI’s ability to externally distribute python scripts containing the “input” -configuration files specific to the Zeus project, as well as the notebooks with the resulting “output” data from the -Software, all of which may be distributed, displayed, and shared publicly at DLI’s discretion. - -(b) Ownership; Limited Rights. As between the parties, BlockScience owns and retains all right, title and interest in -and to the Software, and all Intellectual Property Rights therein. DLI’s rights in the Software are limited to those -expressly granted in Section 2(a) and in the PSA. BlockScience reserves all rights and licenses in the Software not -expressly granted to DLI herein and in the PSA. - -(c) Delivery. BlockScience will deliver a copy of the Software and Documentation to DLI on the Effective Date. The -delivery may be made in electronic form, or via hardcopy medium (e.g., a CD). - -(d) Updates. BlockScience will deliver Updates to DLI as and when such Updates become available. The obligation to -deliver Updates will continue for as long as the PSA remains in force; upon termination or expiration of the PSA, -BlockScience’s obligation to provide Updates will automatically terminate. - -(e) Support. BlockScience will provide reasonable technical support for the Software, to help DLI manage any support -issues that arise. The obligation to provide support will continue for as long as the PSA remains in force; upon -termination or expiration of the PSA, BlockScience’s obligation to provide support will automatically terminate. - -3. NO FEES. - -There are no fees owed by DLI for the license granted or the Updates or support provided by BlockScience -pursuant to this Agreement. Each party will bear its own costs and expenses arising out of or relating to its -obligations, efforts and performance under this Agreement. - -4. LIMITED WARRANTY; DISCLAIMER - -(a) Limited Warranty. BlockScience represents and warrants as follows: (i) that it has the right to enter into this -Agreement, and to perform its obligations hereunder, without violating the terms of any other agreement; (ii) that the -Software, and any Updates, do not and will not infringe, violate, or misappropriate the Intellectual Property Rights of -any third party; (iii) that the Software and any Updates do not and will not contain any virus, malware, spyware, trojan -horse, or other malicious code; and (iv) that the Software and each Update will substantially conform to its -Documentation. - -(b) Disclaimer. EXCEPT AS OTHERWISE SET FORTH IN THIS AGREEMENT, BLOCKSCIENCE DISCLAIMS ALL OTHER WARRANTIES, EXPRESS OR -IMPLIED, RELATED TO THE SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR -PURPOSE. - -5. TERM & TERMINATION - -(a) Term. This Agreement begins on the Effective Date, and will continue in effect until one of us terminates it in -accordance with Section 5(b). - -(b) Termination for Breach. Either party may terminate this Agreement if the other party breaches any material term or -condition of this Agreement, and the breaching party fails to cure the breach within thirty (30) days of receiving -written notice of it. - -(c) Survival. Sections 2 through 7 will survive termination or expiration of this Agreement. - -6. INDEMNIFICATION. - -BlockScience will defend, indemnify, and hold DLI harmless from and against any claim, damage, loss, -liability, expense and cost (including, without limitation, reasonable attorneys’ fees) incurred by or brought against -DLI arising out of or related to: (i) any claim that the Software infringes or misappropriates the Intellectual Property -Rights of that third party; or (ii) BlockScience’s breach of its limited warranties in Section 4(a). - -7. GENERAL TERMS - -(a) Entire Agreement; Waiver. This Agreement is the entire understanding of the parties, and supersedes any and all -prior agreements or understandings between the parties as to its subject matter. It may be amended or modified, or -provisions waived, only in a writing signed by both parties. The waiver of a breach of any provision of this Agreement -will not operate or be interpreted as a waiver of any other or subsequent breach. - -(b) Acknowledgement. BlockScience acknowledges and agrees that the “behaviour archetypes” and “configuration of the Null -Model” referenced in the PSA are considered “Work Product” under the PSA. - -(c) Governing Law. This Agreement will be construed, interpreted and applies in accordance with the internal laws of -British Columbia, Canada (excluding its body of law controlling conflicts of law). Any legal action or proceeding -arising under or related to this Agreement will be brought exclusively in the federal or provincial courts located in -Vancouver, British Columbia, and the parties irrevocably consent to personal jurisdiction and venue there. - -(d) Severability. If any provision of this Agreement is held to be invalid or unenforceable for any reason, that -provision will be enforced to the maximum extent permitted by law, and the remaining provisions will continue in full -force and effect. - -(e) Miscellaneous. This Agreement may be executed in one or more counterparts, with the same effect as if the parties -had signed the same document. Each counterpart so executed will be deemed to be an original, and all such counterparts -will be construed together and will constitute one Agreement. The prevailing party in any action or legal proceeding -arising out of this Agreement will be entitled to recover from the other party all reasonable costs and expenses -incurred in connection with such action or proceeding, including reasonable attorneys’ fees and court costs. In the -event of a direct conflict between the terms of this Agreement and the PSA with respect to the DLI’s rights in and to -the Software, the terms of this Agreement will control. - -EXHIBIT A - -SOFTWARE - -Software Name: SimCAD tool - -Software Description: SimCAD is a Monte-Carlo 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 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. Simulations can 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. \ No newline at end of file From df5707182192019f464a8c732273a08b13750973 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Wed, 9 Jan 2019 18:28:33 -0500 Subject: [PATCH 7/9] test --- SimCAD/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SimCAD/__init__.py b/SimCAD/__init__.py index 206f79c..bd4d6aa 100644 --- a/SimCAD/__init__.py +++ b/SimCAD/__init__.py @@ -1 +1,2 @@ -configs = [] \ No newline at end of file +configs = [] +# \ No newline at end of file From 43e8b8cfab1a5014f3a4be081ed27bfcefd359bf Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Wed, 9 Jan 2019 18:43:45 -0500 Subject: [PATCH 8/9] master cleanup --- SimCAD/__init__.py | 2 +- SimCAD/configuration/__init__.py | 6 +----- SimCAD/configuration/utils/__init__.py | 6 +----- .../utils/behaviorAggregation.py | 6 +----- SimCAD/engine/__init__.py | 5 +---- SimCAD/engine/simulation.py | 20 ++++--------------- SimCAD/engine/utils.py | 8 -------- SimCAD/utils/__init__.py | 16 ++------------- simulations/sim_test.py | 2 +- 9 files changed, 12 insertions(+), 59 deletions(-) diff --git a/SimCAD/__init__.py b/SimCAD/__init__.py index bd4d6aa..3f660d7 100644 --- a/SimCAD/__init__.py +++ b/SimCAD/__init__.py @@ -1,2 +1,2 @@ configs = [] -# \ No newline at end of file +# diff --git a/SimCAD/configuration/__init__.py b/SimCAD/configuration/__init__.py index 0af1af7..223de64 100644 --- a/SimCAD/configuration/__init__.py +++ b/SimCAD/configuration/__init__.py @@ -49,7 +49,6 @@ class Processor: self.state_identity = id.state_identity self.apply_identity_funcs = id.apply_identity_funcs - # Make returntype chosen by user. def create_matrix_field(self, mechanisms, key): if key == 'states': identity = self.state_identity @@ -62,11 +61,8 @@ class Processor: else: return pd.DataFrame({'empty': []}) - # Maybe Refactor to only use dictionary BUT I used dfs to fill NAs. Perhaps fill def generate_config(self, state_dict, mechanisms, exo_proc): - # ToDo: include False / False case - # ToDo: Use Range multiplier instead for loop iterator def no_update_handler(bdf, sdf): if (bdf.empty == False) and (sdf.empty == True): bdf_values = bdf.values.tolist() @@ -98,4 +94,4 @@ class Processor: sdf_values, bdf_values = only_ep_handler(state_dict) zipped_list = list(zip(sdf_values, bdf_values)) - return list(map(lambda x: (x[0] + exo_proc, x[1]), zipped_list)) \ No newline at end of file + return list(map(lambda x: (x[0] + exo_proc, x[1]), zipped_list)) diff --git a/SimCAD/configuration/utils/__init__.py b/SimCAD/configuration/utils/__init__.py index 5364566..62c339a 100644 --- a/SimCAD/configuration/utils/__init__.py +++ b/SimCAD/configuration/utils/__init__.py @@ -8,7 +8,6 @@ class TensorFieldReport: def __init__(self, config_proc): self.config_proc = config_proc - # ??? dont for-loop to apply exo_procs, use exo_proc struct def create_tensor_field(self, mechanisms, exo_proc, keys=['behaviors', 'states']): dfs = [self.config_proc.create_matrix_field(mechanisms, k) for k in keys] df = pd.concat(dfs, axis=1) @@ -19,7 +18,6 @@ class TensorFieldReport: def bound_norm_random(rng, low, high): - # Add RNG Seed res = rng.normal((high+low)/2,(high-low)/6) if (reshigh): res = bound_norm_random(rng, low, high) @@ -34,7 +32,6 @@ def proc_trigger(trigger_step, update_f, step): return lambda x: x -# accept timedelta instead of timedelta params t_delta = timedelta(days=0, minutes=0, seconds=30) def time_step(dt_str, dt_format='%Y-%m-%d %H:%M:%S', _timedelta = t_delta): dt = datetime.strptime(dt_str, dt_format) @@ -42,7 +39,6 @@ def time_step(dt_str, dt_format='%Y-%m-%d %H:%M:%S', _timedelta = t_delta): return t.strftime(dt_format) -# accept timedelta instead of timedelta params t_delta = timedelta(days=0, minutes=0, seconds=1) def ep_time_step(s, dt_str, fromat_str='%Y-%m-%d %H:%M:%S', _timedelta = t_delta): if s['mech_step'] == 0: @@ -54,7 +50,7 @@ def ep_time_step(s, dt_str, fromat_str='%Y-%m-%d %H:%M:%S', _timedelta = t_delta def exo_update_per_ts(ep): @curried def ep_decorator(f, y, step, sL, s, _input): - if s['mech_step'] + 1 == 1: # inside f body to reduce performance costs + if s['mech_step'] + 1 == 1: return f(step, sL, s, _input) else: return (y, s[y]) diff --git a/SimCAD/configuration/utils/behaviorAggregation.py b/SimCAD/configuration/utils/behaviorAggregation.py index abde5d6..5f8b5f6 100644 --- a/SimCAD/configuration/utils/behaviorAggregation.py +++ b/SimCAD/configuration/utils/behaviorAggregation.py @@ -27,8 +27,7 @@ def foldr_dict_vals(f, d): def sum_dict_values(): return foldr_dict_vals(add) -# AttributeError: 'int' object has no attribute 'keys' -# config7c + @curried def dict_op(f, d1, d2): def set_base_value(target_dict, source_dict, key): @@ -44,6 +43,3 @@ def dict_op(f, d1, d2): def dict_elemwise_sum(): return dict_op(add) - - -# class BehaviorAggregation: \ No newline at end of file diff --git a/SimCAD/engine/__init__.py b/SimCAD/engine/__init__.py index 9f87879..97fa7ce 100644 --- a/SimCAD/engine/__init__.py +++ b/SimCAD/engine/__init__.py @@ -11,7 +11,6 @@ class ExecutionMode: multi_proc = 'multi_proc' -# ToDo: switch / rename self.name & context ?? class ExecutionContext: def __init__(self, context=ExecutionMode.multi_proc): self.name = context @@ -65,8 +64,6 @@ class Executor: config_idx += 1 - # Dimensions: N x r x mechs - if self.exec_context == ExecutionMode.single_proc: tensor_field = create_tensor_field(mechanisms.pop(), eps.pop()) result = self.exec_method(simulation_execs, states_lists, configs_structs, env_processes_list, Ts, Ns) @@ -77,4 +74,4 @@ class Executor: results = [] for result, mechanism, ep in list(zip(simulations, mechanisms, eps)): results.append((flatten(result), create_tensor_field(mechanism, ep))) - return results \ No newline at end of file + return results diff --git a/SimCAD/engine/simulation.py b/SimCAD/engine/simulation.py index 271f538..2660d2a 100644 --- a/SimCAD/engine/simulation.py +++ b/SimCAD/engine/simulation.py @@ -1,10 +1,7 @@ from copy import deepcopy from fn.op import foldr, call - -from SimCAD.utils import rename from SimCAD.engine.utils import engine_exception - id_exception = engine_exception(KeyError, KeyError, None) @@ -14,7 +11,6 @@ class Executor: self.state_update_exception = state_update_exception self.behavior_update_exception = behavior_update_exception - # Data Type reduction def get_behavior_input(self, step, sL, s, funcs): ops = self.behavior_ops[::-1] @@ -27,18 +23,16 @@ class Executor: for state in state_dict.keys(): if state in list(env_processes.keys()): env_state = env_processes[state] - if (env_state.__name__ == '_curried') or (env_state.__name__ == 'proc_trigger'): # might want to change + if (env_state.__name__ == '_curried') or (env_state.__name__ == 'proc_trigger'): state_dict[state] = env_state(step)(state_dict[state]) else: state_dict[state] = env_state(state_dict[state]) - def mech_step(self, m_step, sL, state_funcs, behavior_funcs, env_processes, t_step, run): last_in_obj = sL[-1] _input = self.state_update_exception(self.get_behavior_input(m_step, sL, last_in_obj, behavior_funcs)) - # ToDo: add env_proc generator to `last_in_copy` iterator as wrapper function last_in_copy = dict([self.behavior_update_exception(f(m_step, sL, last_in_obj, _input)) for f in state_funcs]) for k in last_in_obj: @@ -47,8 +41,7 @@ class Executor: del last_in_obj - # make env proc trigger field agnostic - self.apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp']) # mutating last_in_copy + self.apply_env_proc(env_processes, last_in_copy, last_in_copy['timestamp']) last_in_copy["mech_step"], last_in_copy["time_step"], last_in_copy['run'] = m_step, t_step, run sL.append(last_in_copy) @@ -59,8 +52,6 @@ class Executor: def mech_pipeline(self, states_list, configs, env_processes, t_step, run): m_step = 0 states_list_copy = deepcopy(states_list) - # print(states_list_copy) - # remove copy genesis_states = states_list_copy[-1] genesis_states['mech_step'], genesis_states['time_step'] = m_step, t_step states_list = [genesis_states] @@ -75,11 +66,9 @@ class Executor: return states_list - # rename pipe def block_pipeline(self, states_list, configs, env_processes, time_seq, run): time_seq = [x + 1 for x in time_seq] simulation_list = [states_list] - # print(len(configs)) for time_step in time_seq: pipe_run = self.mech_pipeline(simulation_list[-1], configs, env_processes, time_step, run) _, *pipe_run = pipe_run @@ -87,12 +76,11 @@ class Executor: return simulation_list - # Del _ / head def simulation(self, states_list, configs, env_processes, time_seq, runs): pipe_run = [] for run in range(runs): run += 1 - states_list_copy = deepcopy(states_list) # WHY ??? + states_list_copy = deepcopy(states_list) head, *tail = self.block_pipeline(states_list_copy, configs, env_processes, time_seq, run) genesis = head.pop() genesis['mech_step'], genesis['time_step'], genesis['run'] = 0, 0, run @@ -100,4 +88,4 @@ class Executor: pipe_run += [first_timestep_per_run] + tail del states_list_copy - return pipe_run \ No newline at end of file + return pipe_run diff --git a/SimCAD/engine/utils.py b/SimCAD/engine/utils.py index 947a167..bcf1507 100644 --- a/SimCAD/engine/utils.py +++ b/SimCAD/engine/utils.py @@ -31,11 +31,3 @@ def engine_exception(ErrorType, error_message, exception_function, try_function) except ErrorType: print(error_message) return exception_function - - -# def exception_handler(f, m_step, sL, last_mut_obj, _input): -# try: -# return f(m_step, sL, last_mut_obj, _input) -# except KeyError: -# print("Exception") -# return f(m_step, sL, sL[-2], _input) \ No newline at end of file diff --git a/SimCAD/utils/__init__.py b/SimCAD/utils/__init__.py index 3ee6e50..63d88c6 100644 --- a/SimCAD/utils/__init__.py +++ b/SimCAD/utils/__init__.py @@ -1,5 +1,3 @@ -# from fn.func import curried - def pipe(x): return x @@ -13,20 +11,10 @@ def flatten(l): return [item for sublist in l for item in sublist] -def flatmap(f, items): - return list(map(f, items)) - - def key_filter(l, keyname): return [v[keyname] for k, v in l.items()] -# @curried + def rename(new_name, f): f.__name__ = new_name - return f -# -# def rename(newname): -# def decorator(f): -# f.__name__ = newname -# return f -# return decorator \ No newline at end of file + return f \ No newline at end of file diff --git a/simulations/sim_test.py b/simulations/sim_test.py index ef1daa7..07a4190 100644 --- a/simulations/sim_test.py +++ b/simulations/sim_test.py @@ -3,7 +3,7 @@ from tabulate import tabulate # The following imports NEED to be in the exact same order from SimCAD.engine import ExecutionMode, ExecutionContext, Executor -from simulations.validation import config_1, config_2 +from simulations.validation import config1, config2 from SimCAD import configs # ToDo: pass ExecutionContext with execution method as ExecutionContext input From 609e40ac40035dd61077d3b04b3593b2241a3a30 Mon Sep 17 00:00:00 2001 From: "Joshua E. Jodesty" Date: Wed, 9 Jan 2019 18:45:35 -0500 Subject: [PATCH 9/9] master cleanup 2 --- SimCAD/engine/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/SimCAD/engine/__init__.py b/SimCAD/engine/__init__.py index 97fa7ce..ba418f3 100644 --- a/SimCAD/engine/__init__.py +++ b/SimCAD/engine/__init__.py @@ -42,7 +42,6 @@ class Executor: self.configs = configs self.main = self.execute - def execute(self): config_proc = Processor()