condense external variables

This commit is contained in:
HaoYizhi 2023-06-14 18:00:08 +08:00
parent ad8771c459
commit 36abde1022
13 changed files with 93 additions and 103 deletions

4
.vscode/launch.json vendored
View File

@ -12,9 +12,9 @@
"console": "integratedTerminal", "console": "integratedTerminal",
"justMyCode": true, "justMyCode": true,
"args": [ "args": [
"--exp", "with_exp", "--exp", "test",
"--reset_db", "True", "--reset_db", "True",
"--job", "24" "--job", "1"
] ]
} }
] ]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,7 +23,13 @@ class ControllerDB:
def __init__(self, prefix, reset_flag=0): def __init__(self, prefix, reset_flag=0):
with open('conf_experiment.yaml') as yaml_file: with open('conf_experiment.yaml') as yaml_file:
dct_conf_experiment = yaml.full_load(yaml_file) dct_conf_experiment = yaml.full_load(yaml_file)
assert prefix in ['test', 'without_exp', 'with_exp'], \
"db name not in test, without_exp, with_exp"
self.is_test = prefix == 'test' self.is_test = prefix == 'test'
self.is_with_exp = \
False if prefix == 'test' or prefix == 'without_exp' else True
self.db_name_prefix = prefix self.db_name_prefix = prefix
dct_para_in_test = dct_conf_experiment[ dct_para_in_test = dct_conf_experiment[
'test'] if self.is_test else dct_conf_experiment['not_test'] 'test'] if self.is_test else dct_conf_experiment['not_test']
@ -46,18 +52,8 @@ class ControllerDB:
Firm.fillna(0, inplace=True) Firm.fillna(0, inplace=True)
# fill dct_lst_init_remove_firm_prod # fill dct_lst_init_remove_firm_prod
assert self.db_name_prefix in ['test', 'without_exp', 'with_exp'], \
"db name not in test, without_exp, with_exp"
list_dct = [] list_dct = []
if self.db_name_prefix in ['test', 'without_exp']: if self.is_with_exp:
for _, row in Firm.iterrows():
code = row['Code']
row = row['1':]
for product_code in row.index[row == 1].to_list():
dct = {code: [product_code]}
list_dct.append(dct)
elif self.db_name_prefix in ['with_exp']:
str_sql = "select e_id, count, max_max_ts, " \ str_sql = "select e_id, count, max_max_ts, " \
"dct_lst_init_remove_firm_prod from " \ "dct_lst_init_remove_firm_prod from " \
"iiabmdb.without_exp_experiment as a " \ "iiabmdb.without_exp_experiment as a " \
@ -76,13 +72,20 @@ class ControllerDB:
lambda x: pickle.loads(x)) lambda x: pickle.loads(x))
list_dct = result.loc[result['count'] >= 12, list_dct = result.loc[result['count'] >= 12,
'dct_lst_init_remove_firm_prod'].to_list() 'dct_lst_init_remove_firm_prod'].to_list()
else:
for _, row in Firm.iterrows():
code = row['Code']
row = row['1':]
for product_code in row.index[row == 1].to_list():
dct = {code: [product_code]}
list_dct.append(dct)
# list_dct = [{'140': ['1.4.5.1']}] # list_dct = [{'140': ['1.4.5.1']}]
# list_dct = [{'133': ['1.4.4.1']}] # list_dct = [{'133': ['1.4.4.1']}]
# list_dct = [{'2': ['1.1.3']}] # list_dct = [{'2': ['1.1.3']}]
# list_dct = [{'135': ['1.3.2.1']}] # list_dct = [{'135': ['1.3.2.1']}]
# list_dct = [{'79': ['2.1.3.4']}] # list_dct = [{'79': ['2.1.3.4']}]
# list_dct = [{'99': ['1.3.3']}] # list_dct = [{'99': ['1.3.3']}]
# list_dct = [{'41': ['1.4.5']}] list_dct = [{'41': ['1.4.5']}]
# fill g_bom # fill g_bom
BomNodes = pd.read_csv('BomNodes.csv', index_col=0) BomNodes = pd.read_csv('BomNodes.csv', index_col=0)
@ -98,9 +101,13 @@ class ControllerDB:
g_product_js = json.dumps(nx.adjacency_data(g_bom)) g_product_js = json.dumps(nx.adjacency_data(g_bom))
# insert exp # insert exp
df_xv = pd.read_csv("xv_with_exp.csv", index_col=None) df_xv = pd.read_csv(
f"xv_{'with_exp' if self.is_with_exp else 'without_exp'}.csv",
index_col=None)
# read the OA table # read the OA table
df_oa = pd.read_csv("oa_with_exp.csv", index_col=None) df_oa = pd.read_csv(
f"oa_{'with_exp' if self.is_with_exp else 'without_exp'}.csv",
index_col=None)
df_oa = df_oa.iloc[:, 0:df_xv.shape[1]] df_oa = df_oa.iloc[:, 0:df_xv.shape[1]]
for idx_scenario, row in df_oa.iterrows(): for idx_scenario, row in df_oa.iterrows():
dct_exp_para = {} dct_exp_para = {}
@ -119,13 +126,10 @@ class ControllerDB:
def add_experiment_1(self, idx_scenario, idx_init_removal, def add_experiment_1(self, idx_scenario, idx_init_removal,
dct_lst_init_remove_firm_prod, g_bom, dct_lst_init_remove_firm_prod, g_bom,
n_max_trial, crit_supplier, n_max_trial, prf_size, prf_conn,
firm_req_prf_size, firm_req_prf_conn,
firm_acc_prf_size, firm_acc_prf_conn,
netw_sply_prf_n, netw_sply_prf_size,
netw_cust_prf_n, netw_cust_prf_size,
cap_limit_prob_type, cap_limit_level, cap_limit_prob_type, cap_limit_level,
diff_new_conn, diff_remove, proactive_ratio): diff_new_conn, crit_supplier, diff_remove,
proactive_ratio, netw_prf_n):
e = Experiment( e = Experiment(
idx_scenario=idx_scenario, idx_scenario=idx_scenario,
idx_init_removal=idx_init_removal, idx_init_removal=idx_init_removal,
@ -134,20 +138,15 @@ class ControllerDB:
dct_lst_init_remove_firm_prod=dct_lst_init_remove_firm_prod, dct_lst_init_remove_firm_prod=dct_lst_init_remove_firm_prod,
g_bom=g_bom, g_bom=g_bom,
n_max_trial=n_max_trial, n_max_trial=n_max_trial,
crit_supplier=crit_supplier, prf_size=prf_size,
firm_req_prf_size=firm_req_prf_size, prf_conn=prf_conn,
firm_req_prf_conn=firm_req_prf_conn,
firm_acc_prf_size=firm_acc_prf_size,
firm_acc_prf_conn=firm_acc_prf_conn,
netw_sply_prf_n=netw_sply_prf_n,
netw_sply_prf_size=netw_sply_prf_size,
netw_cust_prf_n=netw_cust_prf_n,
netw_cust_prf_size=netw_cust_prf_size,
cap_limit_prob_type=cap_limit_prob_type, cap_limit_prob_type=cap_limit_prob_type,
cap_limit_level=cap_limit_level, cap_limit_level=cap_limit_level,
diff_new_conn=diff_new_conn, diff_new_conn=diff_new_conn,
crit_supplier=crit_supplier,
diff_remove=diff_remove, diff_remove=diff_remove,
proactive_ratio=proactive_ratio proactive_ratio=proactive_ratio,
netw_prf_n=netw_prf_n
) )
db_session.add(e) db_session.add(e)
db_session.commit() db_session.commit()

20
firm.py
View File

@ -23,12 +23,10 @@ class FirmAgent(ap.Agent):
self.dct_request_prod_from_firm = {} self.dct_request_prod_from_firm = {}
# para # para
self.flt_crit_supplier = float(self.p.crit_supplier) self.is_prf_size = self.model.is_prf_size
self.is_firm_req_prf_size = bool(self.p.firm_req_prf_size) self.is_prf_conn = bool(self.p.prf_conn)
self.is_firm_req_prf_conn = bool(self.p.firm_req_prf_conn)
self.is_firm_acc_prf_size = bool(self.p.firm_acc_prf_size)
self.is_firm_acc_prf_conn = bool(self.p.firm_acc_prf_conn)
self.flt_diff_new_conn = float(self.p.diff_new_conn) self.flt_diff_new_conn = float(self.p.diff_new_conn)
self.flt_crit_supplier = float(self.p.crit_supplier)
def remove_edge_to_cus_remove_cus_up_prod(self, remove_product): def remove_edge_to_cus_remove_cus_up_prod(self, remove_product):
lst_out_edge = list( lst_out_edge = list(
@ -80,7 +78,7 @@ class FirmAgent(ap.Agent):
continue continue
# select based on connection # select based on connection
lst_firm_connect = [] lst_firm_connect = []
if self.is_firm_req_prf_conn: if self.is_prf_conn:
for firm in \ for firm in \
self.dct_cand_alt_supply_up_prod_removed[product]: self.dct_cand_alt_supply_up_prod_removed[product]:
out_edges = self.model.firm_network.graph.out_edges( out_edges = self.model.firm_network.graph.out_edges(
@ -98,7 +96,7 @@ class FirmAgent(ap.Agent):
lst_firm_connect.append(firm) lst_firm_connect.append(firm)
if len(lst_firm_connect) == 0: if len(lst_firm_connect) == 0:
# select based on size or not # select based on size or not
if self.is_firm_req_prf_size: if self.is_prf_size:
lst_size = \ lst_size = \
[size for size in [size for size in
self.dct_cand_alt_supply_up_prod_removed[ self.dct_cand_alt_supply_up_prod_removed[
@ -113,7 +111,7 @@ class FirmAgent(ap.Agent):
self.dct_cand_alt_supply_up_prod_removed[product]) self.dct_cand_alt_supply_up_prod_removed[product])
elif len(lst_firm_connect) > 0: elif len(lst_firm_connect) > 0:
# select based on size of connected firm or not # select based on size of connected firm or not
if self.is_firm_req_prf_size: if self.is_prf_size:
lst_firm_size = \ lst_firm_size = \
[firm.revenue_log for firm in lst_firm_connect] [firm.revenue_log for firm in lst_firm_connect]
lst_prob = \ lst_prob = \
@ -161,7 +159,7 @@ class FirmAgent(ap.Agent):
elif len(lst_firm) > 1: elif len(lst_firm) > 1:
# handling based on connection # handling based on connection
lst_firm_connect = [] lst_firm_connect = []
if self.is_firm_acc_prf_conn: if self.is_prf_conn:
for firm in lst_firm: for firm in lst_firm:
out_edges = \ out_edges = \
self.model.firm_network.graph.out_edges( self.model.firm_network.graph.out_edges(
@ -182,7 +180,7 @@ class FirmAgent(ap.Agent):
lst_firm_connect.append(firm) lst_firm_connect.append(firm)
if len(lst_firm_connect) == 0: if len(lst_firm_connect) == 0:
# handling based on size or not # handling based on size or not
if self.is_firm_acc_prf_size: if self.is_prf_size:
lst_firm_size = \ lst_firm_size = \
[firm.revenue_log for firm in lst_firm] [firm.revenue_log for firm in lst_firm]
lst_prob = \ lst_prob = \
@ -197,7 +195,7 @@ class FirmAgent(ap.Agent):
self.accept_request(select_customer, product) self.accept_request(select_customer, product)
elif len(lst_firm_connect) > 0: elif len(lst_firm_connect) > 0:
# handling based on size of connected firm or not # handling based on size of connected firm or not
if self.is_firm_acc_prf_size: if self.is_prf_size:
lst_firm_size = \ lst_firm_size = \
[firm.revenue_log for firm in lst_firm_connect] [firm.revenue_log for firm in lst_firm_connect]
lst_prob = \ lst_prob = \

View File

@ -19,14 +19,12 @@ class Model(ap.Model):
self.dct_lst_remove_firm_prod = self.p.dct_lst_init_remove_firm_prod self.dct_lst_remove_firm_prod = self.p.dct_lst_init_remove_firm_prod
self.int_n_max_trial = int(self.p.n_max_trial) self.int_n_max_trial = int(self.p.n_max_trial)
self.int_netw_sply_prf_n = int(self.p.netw_sply_prf_n) self.is_prf_size = bool(self.p.prf_size)
self.is_netw_sply_prf_size = bool(self.p.netw_sply_prf_size)
self.int_netw_cust_prf_n = int(self.p.netw_cust_prf_n)
self.is_netw_cust_prf_size = bool(self.p.netw_cust_prf_size)
self.str_cap_limit_prob_type = str(self.p.cap_limit_prob_type) self.str_cap_limit_prob_type = str(self.p.cap_limit_prob_type)
self.flt_cap_limit_level = float(self.p.cap_limit_level) self.flt_cap_limit_level = float(self.p.cap_limit_level)
self.flt_diff_remove = float(self.p.diff_remove) self.flt_diff_remove = float(self.p.diff_remove)
self.proactive_ratio = float(self.p.proactive_ratio) self.proactive_ratio = float(self.p.proactive_ratio)
self.int_netw_prf_n = int(self.p.netw_prf_n)
# init graph bom # init graph bom
G_bom = nx.adjacency_graph(json.loads(self.p.g_bom)) G_bom = nx.adjacency_graph(json.loads(self.p.g_bom))
@ -81,11 +79,11 @@ class Model(ap.Model):
lst_pred_firm = \ lst_pred_firm = \
Firm['Code'][Firm[pred_product_code] == 1].to_list() Firm['Code'][Firm[pred_product_code] == 1].to_list()
# select multiple supplier (multi-sourcing) # select multiple supplier (multi-sourcing)
n_pred_firm = self.int_netw_sply_prf_n n_pred_firm = self.int_netw_prf_n
if n_pred_firm > len(lst_pred_firm): if n_pred_firm > len(lst_pred_firm):
n_pred_firm = len(lst_pred_firm) n_pred_firm = len(lst_pred_firm)
# based on size or not # based on size or not
if self.is_netw_sply_prf_size: if self.is_prf_size:
lst_pred_firm_size = \ lst_pred_firm_size = \
[G_Firm.nodes[pred_firm]['Revenue_Log'] [G_Firm.nodes[pred_firm]['Revenue_Log']
for pred_firm in lst_pred_firm] for pred_firm in lst_pred_firm]
@ -147,11 +145,11 @@ class Model(ap.Model):
lst_succ_firm = Firm['Code'][ lst_succ_firm = Firm['Code'][
Firm[succ_product_code] == 1].to_list() Firm[succ_product_code] == 1].to_list()
# select multiple customer (multi-selling) # select multiple customer (multi-selling)
n_succ_firm = self.int_netw_cust_prf_n n_succ_firm = self.int_netw_prf_n
if n_succ_firm > len(lst_succ_firm): if n_succ_firm > len(lst_succ_firm):
n_succ_firm = len(lst_succ_firm) n_succ_firm = len(lst_succ_firm)
# based on size or not # based on size or not
if self.is_netw_cust_prf_size: if self.is_prf_size:
lst_succ_firm_size = \ lst_succ_firm_size = \
[G_Firm.nodes[succ_firm]['Revenue_Log'] [G_Firm.nodes[succ_firm]['Revenue_Log']
for succ_firm in lst_succ_firm] for succ_firm in lst_succ_firm]

View File

@ -1,37 +1,37 @@
X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18,X19,X20,X21,X22,X23 X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18,X19,X20,X21,X22,X23
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2,1,1,1,2,1,1,2,2,2,2,2,1,2,1,1,1,1,1,2,2,2,2 1,0,0,0,1,0,0,1,1,1,1,1,0,1,0,0,0,0,0,1,1,1,1
3,1,1,1,3,1,1,3,3,3,3,3,1,3,1,1,1,1,1,3,3,3,3 2,0,0,0,2,0,0,2,2,2,2,2,0,2,0,0,0,0,0,2,2,2,2
1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3 0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2
2,1,1,1,2,1,1,2,2,3,3,3,2,3,2,2,2,2,2,1,1,1,1 1,0,0,0,1,0,0,1,1,2,2,2,1,2,1,1,1,1,1,0,0,0,0
3,1,1,1,3,1,1,3,3,1,1,1,2,1,2,2,2,2,2,2,2,2,2 2,0,0,0,2,0,0,2,2,0,0,0,1,0,1,1,1,1,1,1,1,1,1
1,1,1,2,1,2,2,2,3,1,2,3,1,3,1,1,2,2,2,1,2,2,3 0,0,0,1,0,1,1,1,2,0,1,2,0,2,0,0,1,1,1,0,1,1,2
2,1,1,2,2,2,2,3,1,2,3,1,1,1,1,1,2,2,2,2,3,3,1 1,0,0,1,1,1,1,2,0,1,2,0,0,0,0,0,1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,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0

1 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

11
orm.py
View File

@ -55,20 +55,15 @@ class Experiment(Base):
g_bom = Column(Text(4294000000), nullable=False) g_bom = Column(Text(4294000000), nullable=False)
n_max_trial = Column(Integer, nullable=False) n_max_trial = Column(Integer, nullable=False)
firm_req_prf_size = Column(Boolean, nullable=False) prf_size = Column(Boolean, nullable=False)
firm_req_prf_conn = Column(Boolean, nullable=False) prf_conn = Column(Boolean, nullable=False)
cap_limit_prob_type = Column(String(16), nullable=False) cap_limit_prob_type = Column(String(16), nullable=False)
cap_limit_level = Column(DECIMAL(8, 4), nullable=False) cap_limit_level = Column(DECIMAL(8, 4), nullable=False)
firm_acc_prf_size = Column(Boolean, nullable=False)
firm_acc_prf_conn = Column(Boolean, nullable=False)
diff_new_conn = Column(DECIMAL(8, 4), nullable=False) diff_new_conn = Column(DECIMAL(8, 4), nullable=False)
crit_supplier = Column(DECIMAL(8, 4), nullable=False) crit_supplier = Column(DECIMAL(8, 4), nullable=False)
diff_remove = Column(DECIMAL(8, 4), nullable=False) diff_remove = Column(DECIMAL(8, 4), nullable=False)
proactive_ratio = Column(DECIMAL(8, 4), nullable=False) proactive_ratio = Column(DECIMAL(8, 4), nullable=False)
netw_sply_prf_n = Column(Integer, nullable=False) netw_prf_n = Column(Integer, nullable=False)
netw_sply_prf_size = Column(Boolean, nullable=False)
netw_cust_prf_n = Column(Integer, nullable=False)
netw_cust_prf_size = Column(Boolean, nullable=False)
sample = relationship( sample = relationship(
'Sample', back_populates='experiment', lazy='dynamic') 'Sample', back_populates='experiment', lazy='dynamic')

View File

@ -1,4 +1,4 @@
n_max_trial,firm_req_prf_size,firm_req_prf_conn,cap_limit_prob_type,cap_limit_level,firm_acc_prf_size,firm_acc_prf_conn,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_sply_prf_n,netw_sply_prf_size,netw_cust_prf_n,netw_cust_prf_size n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_prf_n
15,TRUE,TRUE,uniform,5,TRUE,TRUE,0.3,2,0.5,0.3,3,TRUE,3,TRUE 15,TRUE,TRUE,uniform,5,0.3,2,0.5,0.3,3
10,FALSE,FALSE,normal,10,FALSE,FALSE,0.5,1,1,0.5,2,FALSE,2,FALSE 10,FALSE,FALSE,normal,10,0.5,1,1,0.5,2
5,,,,15,,,0.7,0.5,2,0.7,1,,1, 5,,,,15,0.7,0.5,2,0.7,1

1 n_max_trial firm_req_prf_size prf_size firm_req_prf_conn prf_conn cap_limit_prob_type cap_limit_level firm_acc_prf_size diff_new_conn firm_acc_prf_conn crit_supplier diff_remove proactive_ratio netw_prf_n netw_sply_prf_n netw_sply_prf_size netw_cust_prf_n netw_cust_prf_size
2 15 TRUE TRUE TRUE TRUE uniform 5 TRUE 0.3 TRUE 2 0.5 0.3 3 3 TRUE 3 TRUE
3 10 FALSE FALSE FALSE FALSE normal 10 FALSE 0.5 FALSE 1 1 0.5 2 2 FALSE 2 FALSE
4 5 15 0.7 0.5 2 0.7 1 1 1

View File

@ -1,2 +1,2 @@
n_max_trial,firm_req_prf_size,firm_req_prf_conn,cap_limit_prob_type,cap_limit_level,firm_acc_prf_size,firm_acc_prf_conn,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_sply_prf_n,netw_sply_prf_size,netw_cust_prf_n,netw_cust_prf_size n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,diff_remove,proactive_ratio,netw_prf_n
10,TRUE,TRUE,uniform,10,TRUE,TRUE,0.5,1,1,0,2,TRUE,2,TRUE 10,TRUE,TRUE,uniform,10,0.5,1,1,0,2

1 n_max_trial firm_req_prf_size prf_size firm_req_prf_conn prf_conn cap_limit_prob_type cap_limit_level firm_acc_prf_size diff_new_conn firm_acc_prf_conn crit_supplier diff_remove proactive_ratio netw_prf_n netw_sply_prf_n netw_sply_prf_size netw_cust_prf_n netw_cust_prf_size
2 10 TRUE TRUE TRUE TRUE uniform 10 TRUE 0.5 TRUE 1 1 0 2 2 TRUE 2 TRUE