stuff
This commit is contained in:
parent
3554968c68
commit
a0160d7606
|
|
@ -14,8 +14,8 @@ class Configuration:
|
||||||
sim_config,
|
sim_config,
|
||||||
genesis_states: Dict[str, object],
|
genesis_states: Dict[str, object],
|
||||||
seed: Dict[str, RandomState],
|
seed: Dict[str, RandomState],
|
||||||
exogenous_states,
|
exogenous_states: Dict[str, function],
|
||||||
env_processes,
|
env_processes: Dict[str, function],
|
||||||
mechanisms,
|
mechanisms,
|
||||||
behavior_ops=[foldr(dict_elemwise_sum())]):
|
behavior_ops=[foldr(dict_elemwise_sum())]):
|
||||||
self.sim_config = sim_config
|
self.sim_config = sim_config
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,15 @@ class Executor:
|
||||||
|
|
||||||
def mech_step(self, m_step, sL, state_funcs, behavior_funcs, env_processes, t_step, run):
|
def mech_step(self, m_step, sL, state_funcs, behavior_funcs, env_processes, t_step, run):
|
||||||
last_in_obj = sL[-1]
|
last_in_obj = sL[-1]
|
||||||
|
# print(sL)
|
||||||
|
# print(state_funcs)
|
||||||
|
# if m_step == 3:
|
||||||
|
# exit()
|
||||||
|
|
||||||
_input = self.state_update_exception(self.get_behavior_input(m_step, sL, last_in_obj, behavior_funcs))
|
_input = self.behavior_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
|
# 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])
|
last_in_copy = dict([self.state_update_exception(f(m_step, sL, last_in_obj, _input)) for f in state_funcs])
|
||||||
|
|
||||||
for k in last_in_obj:
|
for k in last_in_obj:
|
||||||
if k not in last_in_copy:
|
if k not in last_in_copy:
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ from tabulate import tabulate
|
||||||
|
|
||||||
# The following imports NEED to be in the exact same order
|
# The following imports NEED to be in the exact same order
|
||||||
from SimCAD.engine import ExecutionMode, ExecutionContext, Executor
|
from SimCAD.engine import ExecutionMode, ExecutionContext, Executor
|
||||||
# from simulations.validation import config1, config2
|
from simulations.validation import config1, config2
|
||||||
from simulations.validation import base_config1, base_config2
|
# from simulations.validation import base_config1, base_config2
|
||||||
# from simulations.barlin import config4
|
# from simulations.barlin import config4
|
||||||
# from simulations.zx import config_zx
|
# from simulations.zx import config_zx
|
||||||
# from simulations.barlin import config6atemp #config6aworks,
|
# from simulations.barlin import config6atemp #config6aworks,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import Dict
|
|
||||||
|
|
||||||
from SimCAD import configs
|
from SimCAD import configs
|
||||||
from SimCAD.configuration import Configuration
|
from SimCAD.configuration import Configuration
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ from SimCAD.configuration import Configuration
|
||||||
from SimCAD.configuration.utils import exo_update_per_ts, proc_trigger, bound_norm_random, \
|
from SimCAD.configuration.utils import exo_update_per_ts, proc_trigger, bound_norm_random, \
|
||||||
ep_time_step
|
ep_time_step
|
||||||
|
|
||||||
|
|
||||||
seed = {
|
seed = {
|
||||||
'z': np.random.RandomState(1),
|
'z': np.random.RandomState(1),
|
||||||
'a': np.random.RandomState(2),
|
'a': np.random.RandomState(2),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Dict, List, Tuple
|
||||||
|
|
||||||
|
|
||||||
from SimCAD import configs
|
from SimCAD import configs
|
||||||
|
|
@ -17,7 +18,7 @@ seed = {
|
||||||
|
|
||||||
# Behaviors per Mechanism
|
# Behaviors per Mechanism
|
||||||
# Different return types per mechanism ?? *** No ***
|
# Different return types per mechanism ?? *** No ***
|
||||||
def b1m1(step, sL, s):
|
def b1m1(step: int, sL: List[Dict[str, object]], s: Dict[str, object]) -> Dict[str, object]:
|
||||||
return {'param1': 1}
|
return {'param1': 1}
|
||||||
def b2m1(step, sL, s):
|
def b2m1(step, sL, s):
|
||||||
return {'param2': 4}
|
return {'param2': 4}
|
||||||
|
|
@ -34,7 +35,7 @@ def b2m3(step, sL, s):
|
||||||
|
|
||||||
# deff not more than 2
|
# deff not more than 2
|
||||||
# Internal States per Mechanism
|
# Internal States per Mechanism
|
||||||
def s1m1(step, sL, s, _input):
|
def s1m1(step: int, sL: List[Dict[str, object]], s: Dict[str, object], _input: Dict[str, object]) -> Tuple[int, str]:
|
||||||
y = 's1'
|
y = 's1'
|
||||||
x = _input['param1'] #+ [Coef1 x 5]
|
x = _input['param1'] #+ [Coef1 x 5]
|
||||||
return (y, x)
|
return (y, x)
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ sim_config = {
|
||||||
configs.append(
|
configs.append(
|
||||||
Configuration(
|
Configuration(
|
||||||
sim_config=sim_config,
|
sim_config=sim_config,
|
||||||
state_dict=genesis_states,
|
genesis_states=genesis_states,
|
||||||
seed=seed,
|
seed=seed,
|
||||||
exogenous_states=exogenous_states,
|
exogenous_states=exogenous_states,
|
||||||
env_processes=env_processes,
|
env_processes=env_processes,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue