diff --git a/__pycache__/controller_db.cpython-38.pyc b/__pycache__/controller_db.cpython-38.pyc index 8295673..e33cf51 100644 Binary files a/__pycache__/controller_db.cpython-38.pyc and b/__pycache__/controller_db.cpython-38.pyc differ diff --git a/__pycache__/firm.cpython-38.pyc b/__pycache__/firm.cpython-38.pyc index 033af6f..2264692 100644 Binary files a/__pycache__/firm.cpython-38.pyc and b/__pycache__/firm.cpython-38.pyc differ diff --git a/__pycache__/model.cpython-38.pyc b/__pycache__/model.cpython-38.pyc index d18096c..bd07305 100644 Binary files a/__pycache__/model.cpython-38.pyc and b/__pycache__/model.cpython-38.pyc differ diff --git a/__pycache__/orm.cpython-38.pyc b/__pycache__/orm.cpython-38.pyc index 8e2fae3..778c973 100644 Binary files a/__pycache__/orm.cpython-38.pyc and b/__pycache__/orm.cpython-38.pyc differ diff --git a/controller_db.py b/controller_db.py index 6f648b2..9dacf8e 100644 --- a/controller_db.py +++ b/controller_db.py @@ -45,15 +45,15 @@ class ControllerDB: Firm['Code'] = Firm['Code'].astype('string') Firm.fillna(0, inplace=True) list_dct = [] - # 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) - # # break - # # break - list_dct = [{'140': ['1.4.5.1']}] + 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) + break + break + # list_dct = [{'140': ['1.4.5.1']}] for idx_exp, dct in enumerate(list_dct): self.add_experiment_1(idx_exp, self.dct_parameter['n_max_trial'], dct) diff --git a/firm.py b/firm.py index e24eb33..0670e2a 100644 --- a/firm.py +++ b/firm.py @@ -123,11 +123,12 @@ class FirmAgent(ap.Agent): # print(product.code, [firm.name for firm in list_firm]) 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.positions[self], - self.firm_network.positions[down_firm], { - 'Product': product.code - }) + self.firm_network.positions[down_firm], { + 'Product': product.code + }) ]) self.dct_prod_capacity[product] -= 1 self.dct_request_prod_from_firm[product].remove(down_firm)