reorder exp table + diff_new_conn

This commit is contained in:
HaoYizhi 2023-06-11 15:06:50 +08:00
parent 48077189f0
commit daab7af6ee
6 changed files with 31 additions and 20 deletions

Binary file not shown.

Binary file not shown.

View File

@ -198,14 +198,7 @@ class FirmAgent(ap.Agent):
self.accept_request(select_customer, product) self.accept_request(select_customer, product)
def accept_request(self, down_firm, product): def accept_request(self, down_firm, product):
lst_firm_size = [ prod_accept = self.flt_diff_new_conn
firm.revenue_log for firm in self.model.a_lst_total_firms
if product in firm.a_lst_product
and product not in firm.a_lst_product_removed
]
prod_accept = self.revenue_log / sum(lst_firm_size)
# damp prod
prod_accept = prod_accept ** self.flt_diff_new_conn
if self.model.nprandom.choice([True, False], if self.model.nprandom.choice([True, False],
p=[prod_accept, 1 - prod_accept]): p=[prod_accept, 1 - prod_accept]):
self.firm_network.graph.add_edges_from([ self.firm_network.graph.add_edges_from([

12
orm.py
View File

@ -55,20 +55,20 @@ 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)
crit_supplier = Column(DECIMAL(8, 4), nullable=False)
firm_req_prf_size = Column(DECIMAL(8, 4), nullable=False) firm_req_prf_size = Column(DECIMAL(8, 4), nullable=False)
firm_req_prf_conn = Column(Boolean, nullable=False) firm_req_prf_conn = Column(Boolean, nullable=False)
cap_limit_prob_type = Column(String(16), nullable=False)
cap_limit_level = Column(DECIMAL(8, 4), nullable=False)
firm_acc_prf_size = Column(DECIMAL(8, 4), nullable=False) firm_acc_prf_size = Column(DECIMAL(8, 4), nullable=False)
firm_acc_prf_conn = Column(Boolean, nullable=False) firm_acc_prf_conn = Column(Boolean, nullable=False)
diff_new_conn = Column(DECIMAL(8, 4), nullable=False)
crit_supplier = Column(DECIMAL(8, 4), nullable=False)
diff_remove = Column(DECIMAL(8, 4), nullable=False)
proactive_ratio = Column(DECIMAL(8, 4), nullable=False)
netw_sply_prf_n = Column(Integer, nullable=False) netw_sply_prf_n = Column(Integer, nullable=False)
netw_sply_prf_size = Column(Boolean, nullable=False) netw_sply_prf_size = Column(Boolean, nullable=False)
netw_cust_prf_n = Column(Integer, nullable=False) netw_cust_prf_n = Column(Integer, nullable=False)
netw_cust_prf_size = Column(Boolean, nullable=False) netw_cust_prf_size = Column(Boolean, nullable=False)
cap_limit_prob_type = Column(String(16), nullable=False)
cap_limit_level = Column(DECIMAL(8, 4), nullable=False)
diff_new_conn = Column(DECIMAL(8, 4), nullable=False)
diff_remove = Column(DECIMAL(8, 4), nullable=False)
proactive_ratio = Column(DECIMAL(8, 4), 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,crit_supplier,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,diff_new_conn,diff_remove,proactive_ratio 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
15,2,2,TRUE,2,TRUE,3,TRUE,3,TRUE,uniform,5,0.5,0.5,0.4 15,2,TRUE,uniform,5,2,TRUE,0.3,2,0.5,0.4,3,TRUE,3,TRUE
10,1,1,FALSE,1,FALSE,2,FALSE,2,FALSE,normal,10,1,1,0.6 10,1,FALSE,normal,10,1,FALSE,0.5,1,1,0.6,2,FALSE,2,FALSE
5,0.5,0.5,,0.5,,1,,1,,,15,2,2,0.8 5,0.5,,,15,0.5,,0.7,0.5,2,0.8,1,,1,

1 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
2 15 2 TRUE uniform 5 2 TRUE 0.5 0.3 2 0.5 0.4 3 TRUE 3 TRUE
3 10 1 FALSE normal 10 1 FALSE 1 0.5 1 1 0.6 2 FALSE 2 FALSE
4 5 0.5 15 0.5 2 0.7 0.5 2 0.8 1 1

View File

@ -1,2 +1,20 @@
n_max_trial,crit_supplier,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,diff_new_conn,diff_remove,proactive_ratio 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
10,1,1,TRUE,1,TRUE,2,TRUE,2,TRUE,uniform,10,1,1,0.9 10,1,TRUE,uniform,10,1,TRUE,0.7,1,1,0.9,2,TRUE,2,TRUE
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
,,,,,,,,,,,,,,
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,,,,,,,,,,,,,,

1 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
2 10 1 TRUE uniform 10 1 TRUE 1 0.7 1 1 0.9 2 TRUE 2 TRUE
3
4
5
6 n_max_trial
7 firm_req_prf_size
8 firm_req_prf_conn
9 cap_limit_prob_type
10 cap_limit_level
11 firm_acc_prf_size
12 firm_acc_prf_conn
13 diff_new_conn
14 crit_supplier
15 diff_remove
16 proactive_ratio
17 netw_sply_prf_n
18 netw_sply_prf_size
19 netw_cust_prf_n
20 netw_cust_prf_size