diff --git a/engine/__pycache__/__init__.cpython-36.pyc b/engine/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 9fe0485..0000000 Binary files a/engine/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/engine/__pycache__/__init__.cpython-37.pyc b/engine/__pycache__/__init__.cpython-37.pyc deleted file mode 100644 index 01f339d..0000000 Binary files a/engine/__pycache__/__init__.cpython-37.pyc and /dev/null differ diff --git a/engine/__pycache__/configProcessor.cpython-36.pyc b/engine/__pycache__/configProcessor.cpython-36.pyc deleted file mode 100644 index b575caf..0000000 Binary files a/engine/__pycache__/configProcessor.cpython-36.pyc and /dev/null differ diff --git a/engine/__pycache__/configProcessor.cpython-37.pyc b/engine/__pycache__/configProcessor.cpython-37.pyc deleted file mode 100644 index faa49be..0000000 Binary files a/engine/__pycache__/configProcessor.cpython-37.pyc and /dev/null differ diff --git a/engine/__pycache__/mechanismExecutor.cpython-36.pyc b/engine/__pycache__/mechanismExecutor.cpython-36.pyc deleted file mode 100644 index 9bbf837..0000000 Binary files a/engine/__pycache__/mechanismExecutor.cpython-36.pyc and /dev/null differ diff --git a/engine/__pycache__/mechanismExecutor.cpython-37.pyc b/engine/__pycache__/mechanismExecutor.cpython-37.pyc deleted file mode 100644 index 1a9ad37..0000000 Binary files a/engine/__pycache__/mechanismExecutor.cpython-37.pyc and /dev/null differ diff --git a/engine/__pycache__/run.cpython-36.pyc b/engine/__pycache__/run.cpython-36.pyc deleted file mode 100644 index 5e55019..0000000 Binary files a/engine/__pycache__/run.cpython-36.pyc and /dev/null differ diff --git a/engine/__pycache__/run.cpython-37.pyc b/engine/__pycache__/run.cpython-37.pyc deleted file mode 100644 index cddb38d..0000000 Binary files a/engine/__pycache__/run.cpython-37.pyc and /dev/null differ diff --git a/engine/__pycache__/utils.cpython-36.pyc b/engine/__pycache__/utils.cpython-36.pyc deleted file mode 100644 index b98d799..0000000 Binary files a/engine/__pycache__/utils.cpython-36.pyc and /dev/null differ diff --git a/engine/__pycache__/utils.cpython-37.pyc b/engine/__pycache__/utils.cpython-37.pyc deleted file mode 100644 index 4142993..0000000 Binary files a/engine/__pycache__/utils.cpython-37.pyc and /dev/null differ diff --git a/engine/mechanismExecutor.py b/engine/mechanismExecutor.py index b3fe0f3..37fdab4 100644 --- a/engine/mechanismExecutor.py +++ b/engine/mechanismExecutor.py @@ -21,8 +21,12 @@ def mech_step(m_step, sL, state_funcs, behavior_funcs, env_processes, t_step): _input = getBehaviorInput(m_step, sL, last_in_obj, behavior_funcs) - for f in state_funcs: - f(m_step, sL, last_mut_obj, _input) + # OLD: no bueno! Mutation Bad + # for f in state_funcs: + # f(m_step, sL, last_mut_obj, _input) + + # New + last_mut_obj = dict([ f(m_step, sL, last_mut_obj, _input) for f in state_funcs ]) apply_env_proc(env_processes, last_mut_obj, last_mut_obj['timestamp']) diff --git a/test.py b/test.py index 21e3670..43e5f85 100644 --- a/test.py +++ b/test.py @@ -1,2 +1,4 @@ from engine import run -run.main() \ No newline at end of file +from tabulate import tabulate +result = run.main() +print(tabulate(result, headers='keys', tablefmt='psql')) \ No newline at end of file diff --git a/ui/__pycache__/config.cpython-36.pyc b/ui/__pycache__/config.cpython-36.pyc deleted file mode 100644 index 66450cb..0000000 Binary files a/ui/__pycache__/config.cpython-36.pyc and /dev/null differ diff --git a/ui/config.py b/ui/config.py index 0a23d3d..956bfcd 100644 --- a/ui/config.py +++ b/ui/config.py @@ -29,29 +29,47 @@ def b2m3(step, sL, s): # Internal States per Mechanism def s1m1(step, sL, s, _input): - s['s1'] = s['s1'] + _input + y = 's1' + x = s['s1'] + _input + return (y, x) def s2m1(step, sL, s, _input): - s['s2'] = s['s2'] + _input + y = 's2' + x = s['s2'] + _input + return (y, x) def s1m2(step, sL, s, _input): - s['s1'] = s['s1'] + _input + y = 's1' + x = s['s1'] + _input + return (y, x) def s2m2(step, sL, s, _input): - s['s2'] = s['s2'] + _input + y = 's2' + x = s['s2'] + _input + return (y, x) def s1m3(step, sL, s, _input): - s['s1'] = s['s1'] + _input + y = 's1' + x = s['s1'] + _input + return (y, x) def s2m3(step, sL, s, _input): - s['s2'] = s['s2'] + _input + y = 's2' + x = s['s2'] + _input + return (y, x) # Exogenous States proc_one_coef_A = 0.7 proc_one_coef_B = 1.3 def es3p1(step, sL, s, _input): - s['s3'] = s['s3'] * bound_norm_random(seed['a'], proc_one_coef_A, proc_one_coef_B) + y = 's3' + x = s['s3'] * bound_norm_random(seed['a'], proc_one_coef_A, proc_one_coef_B) + return (y, x) def es4p2(step, sL, s, _input): - s['s4'] = s['s4'] * bound_norm_random(seed['b'], proc_one_coef_A, proc_one_coef_B) + y = 's4' + x = s['s4'] * bound_norm_random(seed['b'], proc_one_coef_A, proc_one_coef_B) + return (y, x) def es5p2(step, sL, s, _input): # accept timedelta instead of timedelta params - s['timestamp'] = ep_time_step(s, s['timestamp'], seconds=1) + y = 'timestamp' + x = ep_time_step(s, s['timestamp'], seconds=1) + return (y, x) # Environment States def env_a(x):