diff --git a/.vscode/launch.json b/.vscode/launch.json index 87ed9da..e582557 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,9 +12,9 @@ "console": "integratedTerminal", "justMyCode": true, "args": [ - "--exp", "with_exp", + "--exp", "test", "--reset_db", "True", - "--job", "24" + "--job", "1" ] } ] diff --git a/__pycache__/controller_db.cpython-38.pyc b/__pycache__/controller_db.cpython-38.pyc index 3221556..63207e0 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 26921ff..14d7b09 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 1154905..51763fc 100644 Binary files a/__pycache__/model.cpython-38.pyc and b/__pycache__/model.cpython-38.pyc differ diff --git a/conf_db_prefix.yaml b/conf_db_prefix.yaml index 1391188..42cedea 100644 --- a/conf_db_prefix.yaml +++ b/conf_db_prefix.yaml @@ -1 +1 @@ -db_name_prefix: with_exp +db_name_prefix: test diff --git a/controller_db.py b/controller_db.py index 4f3eaf3..a9646ff 100644 --- a/controller_db.py +++ b/controller_db.py @@ -72,7 +72,7 @@ class ControllerDB: # list_dct = [{'133': ['1.4.4.1']}] # list_dct = [{'2': ['1.1.3']}] # 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 = [{'41': ['1.4.5']}] diff --git a/doc/会议20230712.docx b/doc/会议20230712.docx new file mode 100644 index 0000000..dcddeac Binary files /dev/null and b/doc/会议20230712.docx differ diff --git a/doc/新疆会议投稿20230711.pptx b/doc/新疆会议投稿20230711.pptx new file mode 100644 index 0000000..89887e1 Binary files /dev/null and b/doc/新疆会议投稿20230711.pptx differ diff --git a/doc/新疆会议投稿版本.docx b/doc/新疆会议投稿版本.docx new file mode 100644 index 0000000..282bcc2 Binary files /dev/null and b/doc/新疆会议投稿版本.docx differ diff --git a/firm.py b/firm.py index 18cdcc8..db10d0c 100644 --- a/firm.py +++ b/firm.py @@ -261,7 +261,14 @@ class FirmAgent(ap.Agent): def accept_request(self, down_firm, product): # para product is the product that self is selling - prod_accept = self.flt_diff_new_conn + # connected firm has no probability + node_self = self.get_firm_network_node() + node_d_firm = down_firm.get_firm_network_node() + if self.model.firm_network.graph.has_edge(node_self, node_d_firm) or \ + self.model.firm_network.graph.has_edge(node_d_firm, node_self): + prod_accept = 1.0 + else: + prod_accept = self.flt_diff_new_conn if self.model.nprandom.choice([True, False], p=[prod_accept, 1 - prod_accept]): self.firm_network.graph.add_edges_from([ diff --git a/test.ipynb b/test.ipynb index e417a09..c37ecb1 100644 --- a/test.ipynb +++ b/test.ipynb @@ -517,6 +517,48 @@ "result = pd.read_sql(sql=contents, con=engine)\n", "result" ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAApQAAAHzCAYAAACe1o1DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAA9hAAAPYQGoP6dpAAAVT0lEQVR4nO3dz4vV973H8fc5M0SqZKOi2WQIxZiCFbqRhBYpI8FFuTeQ20VzjX9CN4WUghSNhVouhNvN3d277JTclZdw6aKk4y1Cb4JdtDFZRKUk48aIIxQ7pnrHOXcRJxl1fpwz31+fz+f7eOySSb7n6OrF+zlnZjAajUYBAADbNOz6DQAAkDeDEgCASgxKAAAqMSgBAKjEoAQAoBKDEgCASgxKAAAqMSgBAKjEoAQAoBKDEgCASgxKAAAqMSgBAKjE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vwB366ZFACADzmtSMz8cbxg7U868fHX4gfHCnzeydXDUajUdO/ZQgAIEtvX1qIM+98FMsro4k+rDM1HMT0cBA/e+VQ8WMywqAEANjU9dt349T5y3Hx2q2YGg42HZarXz96YG+ce/Vw0Zl7LYMSAGAMVz+7E3PvL8SFKzdjYfFurB1Qg/jih5bPHtwXJ1+aKfbT3BsxKAEAJrR0bzk+WVyK+8sr8dT0MJ7bs6vI34AzLoMSAIBKfMobAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBKDEoAACoxKAEAqMSgBACgEoMSAIBK/h8EZccnAqL14wAAAABJRU5ErkJggg==", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "import networkx as nx\n", + "\n", + "G = nx.MultiDiGraph()\n", + "G.add_edge(1, 2)\n", + "nx.draw(G)\n", + "G.has_edge(1, 2, 1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/xv_with_exp.csv b/xv_with_exp.csv index 3d75219..7428909 100644 --- a/xv_with_exp.csv +++ b/xv_with_exp.csv @@ -1,4 +1,4 @@ n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,proactive_ratio,remove_t,netw_prf_n -15,TRUE,TRUE,uniform,5,0.3,2,0.3,3,3 -10,FALSE,FALSE,normal,10,0.5,1,0.5,5,2 -5,,,,15,0.7,0.5,0.7,7,1 +7,TRUE,TRUE,uniform,5,0.3,2,0.3,3,3 +5,FALSE,FALSE,normal,10,0.5,1,0.5,5,2 +3,,,,15,0.7,0.5,0.7,7,1 diff --git a/xv_without_exp.csv b/xv_without_exp.csv index 9131e86..818ef2b 100644 --- a/xv_without_exp.csv +++ b/xv_without_exp.csv @@ -1,2 +1,2 @@ n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,proactive_ratio,remove_t,netw_prf_n -10,TRUE,TRUE,uniform,10,0.5,1,0,5,2 +5,TRUE,TRUE,uniform,10,0.5,1,0,5,2