Firm accept request conditionally
This commit is contained in:
parent
b935f0ce79
commit
4b34dab443
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -45,15 +45,15 @@ class ControllerDB:
|
||||||
Firm['Code'] = Firm['Code'].astype('string')
|
Firm['Code'] = Firm['Code'].astype('string')
|
||||||
Firm.fillna(0, inplace=True)
|
Firm.fillna(0, inplace=True)
|
||||||
list_dct = []
|
list_dct = []
|
||||||
# for _, row in Firm.iterrows():
|
for _, row in Firm.iterrows():
|
||||||
# code = row['Code']
|
code = row['Code']
|
||||||
# row = row['1':]
|
row = row['1':]
|
||||||
# for product_code in row.index[row == 1].to_list():
|
for product_code in row.index[row == 1].to_list():
|
||||||
# dct = {code: [product_code]}
|
dct = {code: [product_code]}
|
||||||
# list_dct.append(dct)
|
list_dct.append(dct)
|
||||||
# # break
|
break
|
||||||
# # break
|
break
|
||||||
list_dct = [{'140': ['1.4.5.1']}]
|
# list_dct = [{'140': ['1.4.5.1']}]
|
||||||
for idx_exp, dct in enumerate(list_dct):
|
for idx_exp, dct in enumerate(list_dct):
|
||||||
self.add_experiment_1(idx_exp, self.dct_parameter['n_max_trial'],
|
self.add_experiment_1(idx_exp, self.dct_parameter['n_max_trial'],
|
||||||
dct)
|
dct)
|
||||||
|
|
1
firm.py
1
firm.py
|
@ -123,6 +123,7 @@ class FirmAgent(ap.Agent):
|
||||||
# print(product.code, [firm.name for firm in list_firm])
|
# print(product.code, [firm.name for firm in list_firm])
|
||||||
|
|
||||||
def accept_request(self, down_firm, product):
|
def accept_request(self, down_firm, product):
|
||||||
|
# if self.model.nprandom.choice([True, False], p=[0.1, 0.9]):
|
||||||
self.firm_network.graph.add_edges_from([
|
self.firm_network.graph.add_edges_from([
|
||||||
(self.firm_network.positions[self],
|
(self.firm_network.positions[self],
|
||||||
self.firm_network.positions[down_firm], {
|
self.firm_network.positions[down_firm], {
|
||||||
|
|
Loading…
Reference in New Issue