模型逻辑修改完成,没有内容的输出 和对于 数据库的调整 也没有跑代码
This commit is contained in:
parent
356582e2f3
commit
8b231696f6
|
@ -24,6 +24,13 @@
|
|||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\input_data\firm_industry_relation.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\input_data\oa_with_exp.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
|
@ -52,6 +59,69 @@
|
|||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\input_data\测试 BomNodes.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\input_data\测试 Firm_amended 170.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 companies_devices.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 companies_materials.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 companies_products.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 consumed_materials.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 industry_raw_materials_products.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 produced_products.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\测试数据 products_materials_equipment.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -64,12 +64,13 @@ class ControllerDB:
|
|||
# 行索引 (index):这一行在数据帧中的索引值。
|
||||
# 行数据 (row):这一行的数据,是一个 pandas.Series 对象,包含该行的所有列和值。
|
||||
|
||||
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)
|
||||
firm_industry=pd.read_csv("input_data/firm_industry_relation.csv")
|
||||
firm_industry['Firm_Code'] = firm_industry['Firm_Code'].astype('string')
|
||||
for _, row in firm_industry.iterrows():
|
||||
code = row['Firm_Code']
|
||||
row = row['Product_Code']
|
||||
dct = {code: [row]}
|
||||
list_dct.append(dct)
|
||||
|
||||
# fill g_bom
|
||||
# 结点属性值 相当于 图上点的 原始 产品名称
|
||||
|
|
124
firm.py
124
firm.py
|
@ -2,21 +2,54 @@ from mesa import Agent
|
|||
|
||||
|
||||
class FirmAgent(Agent):
|
||||
def __init__(self, unique_id, model, type_region, revenue_log, a_lst_product):
|
||||
def __init__(self, unique_id, model, type_region, revenue_log, n_equip_c, a_lst_product,
|
||||
production_output, demand_quantity, c_price, R, P, C):
|
||||
# 调用超类的 __init__ 方法
|
||||
super().__init__(unique_id, model)
|
||||
|
||||
# 初始化模型中的网络引用
|
||||
self.firm_network = self.model.firm_network
|
||||
self.product_network = self.model.product_network
|
||||
|
||||
# 初始化代理自身的属性
|
||||
self.type_region = type_region
|
||||
|
||||
self.size_stat = []
|
||||
self.dct_prod_up_prod_stat = {}
|
||||
self.dct_prod_capacity = {}
|
||||
|
||||
# 企业涉及的产业
|
||||
self.indus_i = a_lst_product
|
||||
# 各资源库存信息,库存资源,库存量
|
||||
self.R = R
|
||||
# 包括库存时间的值 方便后面统计
|
||||
self.R1 = {0: R}
|
||||
# 设备资产信息,持有设备,设备数量, 增加 设备残值 [[1,2,3],[] ]
|
||||
self.C = C
|
||||
# 包括设备时间步的值
|
||||
self.C1 = {0: C}
|
||||
# 复制一份
|
||||
self.C0 = C
|
||||
# 产品库存信息 库存产品,库存量 ID 数量
|
||||
self.P = P
|
||||
# 包括 产品时间
|
||||
self.P1={0:P}
|
||||
# 企业i的供应商
|
||||
self.upper_i = [u for u, v in self.firm_network.in_edges(self.unique_id)]
|
||||
# 企业i的客户
|
||||
self.downer_i = [u for u, v in self.firm_network.out_edges(self.unique_id)]
|
||||
# 设备c的数量 (总量) 使用这个来判断设备数量
|
||||
self.n_equip_c = n_equip_c
|
||||
# 设备c产量 更具设备量进行估算
|
||||
self.c_yield = production_output
|
||||
# 消耗材料量 根据设备量进行估算
|
||||
self.c_consumption = demand_quantity
|
||||
# 设备c购买价格(初始值)
|
||||
self.c_price = c_price
|
||||
# 资源r补货库存阈值
|
||||
self.s_r = 40
|
||||
self.S_r = 120
|
||||
# 设备补货阙值 可选
|
||||
# self.ss_r = 70
|
||||
# 每一个周期步减少残值:x
|
||||
self.x = 20
|
||||
# 试验中的参数
|
||||
self.dct_n_trial_up_prod_disrupted = {}
|
||||
self.dct_cand_alt_supp_up_prod_disrupted = {}
|
||||
|
@ -200,6 +233,89 @@ class FirmAgent(Agent):
|
|||
else:
|
||||
down_firm.dct_cand_alt_supp_up_prod_disrupted[product].remove(self)
|
||||
|
||||
def seek_material_supply(self, material_type):
|
||||
lst_firm_material_connect = [] # 符合条件 可选择的上游
|
||||
upper_i_material = [] # 特定 资源的上游 企业集合
|
||||
for firm in self.upper_i:
|
||||
for sub_list in firm.R:
|
||||
if sub_list[0] == material_type:
|
||||
upper_i_material.append(firm)
|
||||
# 没有 上游 没有 材料的情况,也就是紊乱的情况
|
||||
# if len(upper_i_material)==0:
|
||||
|
||||
if self.is_prf_conn:
|
||||
for firm in upper_i_material:
|
||||
if self.firm_network.has_edge(self.unique_id, firm.unique_id) or self.firm_network.has_edge(
|
||||
firm.unique_id, self.unique_id):
|
||||
lst_firm_material_connect.append(firm)
|
||||
if len(lst_firm_material_connect) == 0:
|
||||
if self.is_prf_size:
|
||||
lst_size = [firm.size_stat[-1][0] for firm in upper_i_material]
|
||||
lst_prob = [size / sum(lst_size) for size in lst_size]
|
||||
select_alt_supply = \
|
||||
self.random.choices(upper_i_material, weights=lst_prob)[0]
|
||||
else:
|
||||
select_alt_supply = self.random.choice(upper_i_material)
|
||||
elif len(lst_firm_material_connect) > 0:
|
||||
if self.is_prf_size:
|
||||
lst_firm_size = [firm.size_stat[-1][0] for firm in lst_firm_material_connect]
|
||||
lst_prob = [size / sum(lst_firm_size) for size in lst_firm_size]
|
||||
select_alt_supply = self.random.choices(lst_firm_material_connect, weights=lst_prob)[0]
|
||||
else:
|
||||
select_alt_supply = self.random.choice(lst_firm_material_connect)
|
||||
return select_alt_supply
|
||||
|
||||
def seek_machinery_supply(self, machinery_type):
|
||||
lst_firm_machinery_connect = [] # 符合条件 可选择的上游
|
||||
upper_i_machinery = [] # 特定 资源的上游 企业集合
|
||||
for firm in self.upper_i:
|
||||
for sub_list in firm.R:
|
||||
if sub_list[0] == machinery_type:
|
||||
upper_i_machinery.append(firm)
|
||||
# 没有 上游 没有 材料的情况,也就是紊乱的情况
|
||||
# if len(upper_i_machinery)==0:
|
||||
|
||||
if self.is_prf_conn:
|
||||
for firm in upper_i_machinery:
|
||||
if self.firm_network.has_edge(self.unique_id, firm.unique_id) or self.firm_network.has_edge(
|
||||
firm.unique_id, self.unique_id):
|
||||
lst_firm_machinery_connect.append(firm)
|
||||
if len(lst_firm_machinery_connect) == 0:
|
||||
if self.is_prf_size:
|
||||
lst_size = [firm.size_stat[-1][0] for firm in upper_i_machinery]
|
||||
lst_prob = [size / sum(lst_size) for size in lst_size]
|
||||
select_alt_supply = \
|
||||
self.random.choices(upper_i_machinery, weights=lst_prob)[0]
|
||||
else:
|
||||
select_alt_supply = self.random.choice(upper_i_machinery)
|
||||
elif len(lst_firm_machinery_connect) > 0:
|
||||
if self.is_prf_size:
|
||||
lst_firm_size = [firm.size_stat[-1][0] for firm in lst_firm_machinery_connect]
|
||||
lst_prob = [size / sum(lst_firm_size) for size in lst_firm_size]
|
||||
select_alt_supply = self.random.choices(lst_firm_machinery_connect, weights=lst_prob)[0]
|
||||
else:
|
||||
select_alt_supply = self.random.choice(lst_firm_machinery_connect)
|
||||
return select_alt_supply
|
||||
|
||||
def handle_material_request(self, material_list):
|
||||
for list in self.P:
|
||||
if list[0] == material_list[0]:
|
||||
list[1] -= material_list[1]
|
||||
|
||||
def handle_machinery_request(self, machinery_list):
|
||||
for list in self.C:
|
||||
if list[0] == machinery_list[0]:
|
||||
list[1] -= machinery_list[1]
|
||||
|
||||
def refresh_R(self):
|
||||
self.R1[self.model.t] = self.R
|
||||
|
||||
def refresh_C(self):
|
||||
self.C1[self.model.t] = self.C
|
||||
|
||||
def refresh_P(self):
|
||||
self.P1[self.model.t] = self.P
|
||||
|
||||
def clean_before_trial(self):
|
||||
self.dct_request_prod_from_firm = {}
|
||||
|
||||
|
|
|
@ -169,4 +169,4 @@
|
|||
167,SZ,2021,78220000000,24.43927396,41100000000,L,9.500843462,13371,qichacha,Non_Beijing,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
168,SH,2021,10350000000,22.23155657,4519000000,L,8.528528701,5057,qichacha,Non_Beijing,,,,1,,,,,,,,,,,,,,,,,,1,1,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,1
|
||||
169,SH,2021,2.30233E+11,24.27012079,34704000000,L,8.55120807,5173,qichacha,Non_Beijing,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
170,,,,18.42068074,100000000,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
170,,,,18.42068074,100000000,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
|
@ -0,0 +1,476 @@
|
|||
Firm_Code,Product_Code
|
||||
0,1.4.4
|
||||
1,2.1.1.5
|
||||
2,1.1.3
|
||||
3,1.3.1.4
|
||||
3,1.3.1.5
|
||||
3,1.3.1.6
|
||||
3,1.3.4.1
|
||||
4,1.2.2
|
||||
5,1.4.5.3
|
||||
5,1.4.5.4
|
||||
5,1.4.5.5
|
||||
5,1.4.5.9
|
||||
6,1.3.1.2
|
||||
6,2.1.2.1
|
||||
6,2.1.2.2
|
||||
6,2.1.2.3
|
||||
6,2.1.2.4
|
||||
7,2.2
|
||||
8,1.4.1.1
|
||||
9,1.3.3.6
|
||||
9,1.3.3.7
|
||||
10,1.3.3.5
|
||||
11,1.4.4.2
|
||||
12,1.2.1
|
||||
13,1.2.2
|
||||
13,2.1.3.1
|
||||
13,2.1.3.2
|
||||
13,2.1.3.3
|
||||
13,2.1.3.4
|
||||
13,2.1.3.5
|
||||
13,2.1.3.6
|
||||
13,2.1.3.7
|
||||
13,2.1.4.1.1
|
||||
13,2.1.4.1.2
|
||||
13,2.1.4.1.3
|
||||
13,2.1.4.1.4
|
||||
13,2.1.4.2.1
|
||||
13,2.1.4.2.2
|
||||
13,2.3.1
|
||||
13,2.3.2
|
||||
13,2.3.3
|
||||
14,1.3.3.4
|
||||
14,1.3.4.3
|
||||
15,1.3.3.5
|
||||
16,1.1.3
|
||||
16,2.3.1
|
||||
16,2.3.2
|
||||
16,2.3.3
|
||||
17,1.4.2.4
|
||||
18,1.3.3.2
|
||||
19,1.4.2.1
|
||||
20,1.3.1.2
|
||||
21,1.3.1.3
|
||||
22,1.2.1
|
||||
22,1.2.2
|
||||
22,1.3.3.6
|
||||
22,2.1.1.1
|
||||
22,2.1.1.2
|
||||
22,2.1.1.3
|
||||
22,2.1.1.4
|
||||
22,2.1.1.5
|
||||
22,2.1.3.1
|
||||
22,2.1.3.2
|
||||
22,2.1.3.3
|
||||
22,2.1.3.4
|
||||
22,2.1.3.5
|
||||
22,2.1.3.6
|
||||
22,2.1.3.7
|
||||
22,2.1.4.1.1
|
||||
22,2.1.4.1.2
|
||||
22,2.1.4.1.3
|
||||
22,2.1.4.1.4
|
||||
22,2.1.4.2.1
|
||||
22,2.1.4.2.2
|
||||
22,2.3.1
|
||||
22,2.3.2
|
||||
22,2.3.3
|
||||
23,1.1.2
|
||||
23,1.3.3.1
|
||||
23,1.3.3.2
|
||||
23,1.3.3.3
|
||||
23,1.3.3.4
|
||||
23,1.4.2.7
|
||||
23,2.1.3.6
|
||||
23,2.3.1
|
||||
23,2.3.2
|
||||
23,2.3.3
|
||||
24,1.1.1
|
||||
25,1.3.1.7
|
||||
26,2.1.3.1
|
||||
26,2.1.3.2
|
||||
26,2.1.3.3
|
||||
26,2.1.3.4
|
||||
26,2.1.3.5
|
||||
26,2.1.3.6
|
||||
26,2.1.3.7
|
||||
27,1.4.4.2
|
||||
28,2.2
|
||||
29,1.3
|
||||
30,1.4.2.6
|
||||
31,1.3.3.3
|
||||
31,2.1.4.1.1
|
||||
31,2.1.4.1.2
|
||||
31,2.1.4.1.3
|
||||
31,2.1.4.1.4
|
||||
31,2.1.4.2.1
|
||||
31,2.1.4.2.2
|
||||
32,1.2.3
|
||||
33,2.1.2.1
|
||||
33,2.1.2.2
|
||||
33,2.1.2.3
|
||||
33,2.1.2.4
|
||||
34,1.3.3.3
|
||||
35,1.1.3
|
||||
36,1.1.1
|
||||
37,1.4.1.2
|
||||
37,1.4.1.4
|
||||
37,1.4.2.2
|
||||
37,1.4.3.1
|
||||
37,1.4.4.3
|
||||
37,1.4.5.2
|
||||
38,2.1.1.1
|
||||
38,2.1.1.2
|
||||
38,2.1.1.3
|
||||
38,2.1.1.4
|
||||
38,2.1.1.5
|
||||
39,1.3.1
|
||||
40,1.4.2.1
|
||||
40,1.4.2.5
|
||||
40,1.4.3.3
|
||||
40,1.4.4
|
||||
41,1.4.1.2
|
||||
41,1.4.1.5
|
||||
41,1.4.3.1
|
||||
41,1.4.3.2
|
||||
41,1.4.3.4
|
||||
41,1.4.3.5
|
||||
41,1.4.5
|
||||
42,1.3.1.1
|
||||
42,1.3.1.3
|
||||
42,1.3.1.4
|
||||
43,1.3.1.5
|
||||
43,1.3.1.6
|
||||
44,1.1.1
|
||||
45,1.3.3.1
|
||||
45,1.3.4.1
|
||||
45,1.3.4.2
|
||||
45,2.1.4.1.1
|
||||
45,2.1.4.1.2
|
||||
45,2.1.4.1.3
|
||||
45,2.1.4.1.4
|
||||
45,2.1.4.2.1
|
||||
45,2.1.4.2.2
|
||||
46,1.3.1.2
|
||||
47,2.1.1.1
|
||||
47,2.1.1.2
|
||||
47,2.1.1.3
|
||||
47,2.1.1.4
|
||||
47,2.1.2.1
|
||||
47,2.1.2.2
|
||||
47,2.1.2.3
|
||||
47,2.1.2.4
|
||||
47,2.1.3.6
|
||||
48,1.2.2
|
||||
49,1.3.1.1
|
||||
49,1.3.1.4
|
||||
49,1.3.1.6
|
||||
49,1.3.3.1
|
||||
49,2.1.2.1
|
||||
49,2.1.2.2
|
||||
49,2.1.2.3
|
||||
49,2.1.2.4
|
||||
50,1.3.1.5
|
||||
51,1.4.2.1
|
||||
52,1.4.5.5
|
||||
53,1.4.1.3
|
||||
53,1.4.1.4
|
||||
53,1.4.1.5
|
||||
53,1.4.2.3
|
||||
53,1.4.2.4
|
||||
53,1.4.3.3
|
||||
53,1.4.3.4
|
||||
53,1.4.3.5
|
||||
53,1.4.3.6
|
||||
53,1.4.4.4
|
||||
53,1.4.5.2
|
||||
53,1.4.5.3
|
||||
53,1.4.5.6
|
||||
53,1.4.5.7
|
||||
53,1.4.5.8
|
||||
54,1.4.1.3
|
||||
54,1.4.2.4
|
||||
54,1.4.4.3
|
||||
55,1.4.1.1
|
||||
55,1.4.1.2
|
||||
55,1.4.1.3
|
||||
55,1.4.2.1
|
||||
55,1.4.2.2
|
||||
55,1.4.4.4
|
||||
56,1.1.1
|
||||
56,1.3.1.7
|
||||
57,1.3.3.3
|
||||
57,2.3.1
|
||||
57,2.3.2
|
||||
57,2.3.3
|
||||
58,1.2.2
|
||||
58,1.3.1.6
|
||||
58,1.3.2
|
||||
58,1.3.4.1
|
||||
58,1.3.4.2
|
||||
58,1.3.4.3
|
||||
58,2.1.2
|
||||
59,1.4.2.5
|
||||
60,2.1.1.1
|
||||
60,2.1.1.2
|
||||
60,2.1.1.3
|
||||
60,2.1.1.4
|
||||
60,2.1.1.5
|
||||
61,1.3.3.3
|
||||
62,1.3.1.2
|
||||
62,2.1.2.1
|
||||
62,2.1.2.2
|
||||
62,2.1.2.3
|
||||
62,2.1.2.4
|
||||
63,1.4.1.1
|
||||
63,1.4.2.4
|
||||
63,1.4.4.5
|
||||
64,1.1.2
|
||||
65,1.2.1
|
||||
66,1.2.1
|
||||
67,1.2
|
||||
68,1.3.1.1
|
||||
68,1.3.1.2
|
||||
68,1.3.1.3
|
||||
69,1.1.1
|
||||
70,1.3.3.2
|
||||
70,1.3.3.4
|
||||
71,1.3.1.2
|
||||
72,1.3.1.2
|
||||
73,2.1.3
|
||||
74,1.3.3.2
|
||||
74,2.1.3
|
||||
75,1.3.3
|
||||
76,1.3.1.3
|
||||
77,1.3.3.6
|
||||
77,1.3.4
|
||||
78,2.1.1.1
|
||||
78,2.1.1.2
|
||||
78,2.1.1.3
|
||||
78,2.1.1.4
|
||||
78,2.1.1.5
|
||||
79,1.3.1.1
|
||||
79,1.3.1.4
|
||||
79,1.3.1.6
|
||||
79,2.1.2
|
||||
79,2.1.3.1
|
||||
79,2.1.3.2
|
||||
79,2.1.3.3
|
||||
79,2.1.3.4
|
||||
79,2.1.3.5
|
||||
79,2.1.3.6
|
||||
79,2.1.3.7
|
||||
79,2.1.4.1
|
||||
79,2.1.4.2
|
||||
79,2.3.1
|
||||
79,2.3.2
|
||||
79,2.3.3
|
||||
80,1.3.4
|
||||
80,2.1.1
|
||||
81,1.3.4
|
||||
81,2.1.2
|
||||
81,2.1.4.1
|
||||
81,2.1.4.2
|
||||
82,2.1.2.1
|
||||
82,2.1.2.2
|
||||
82,2.1.2.3
|
||||
82,2.1.2.4
|
||||
83,1.3.3.2
|
||||
84,2.1.2
|
||||
84,2.1.4
|
||||
84,2.3
|
||||
85,1.3.1
|
||||
85,2.1.1
|
||||
86,1.1
|
||||
87,1.1.1
|
||||
88,1.1.3
|
||||
89,1.1.2
|
||||
89,1.2.1
|
||||
89,1.3.3.1
|
||||
90,1.3.1.7
|
||||
91,1.2.1
|
||||
92,1.3.3.4
|
||||
93,1.3.1
|
||||
94,1.1
|
||||
95,1.2.3
|
||||
95,2.3
|
||||
96,1.2.1
|
||||
96,1.2.3
|
||||
97,1.2
|
||||
97,1.3.3
|
||||
97,2.1.3
|
||||
98,2
|
||||
99,1.1.2
|
||||
99,1.2.1
|
||||
99,1.3.1
|
||||
99,1.3.3
|
||||
99,2.1
|
||||
99,2.3
|
||||
100,1.3.1
|
||||
101,1.1.1
|
||||
102,2
|
||||
102,2.1.4
|
||||
103,1.1.1
|
||||
104,1.1.1
|
||||
105,1.1
|
||||
106,1.1
|
||||
106,1.2
|
||||
106,1.3
|
||||
106,2.1.1
|
||||
106,2.1.3
|
||||
106,2.2
|
||||
107,1.4.3.3
|
||||
108,2.1.3
|
||||
108,2.2
|
||||
109,1.3.3.1
|
||||
110,1.3.3.5
|
||||
111,1.3.1.6
|
||||
111,1.3.3.1
|
||||
111,1.3.4.1
|
||||
112,1.3.3.7
|
||||
113,1.1.1
|
||||
114,1.3.5.1
|
||||
115,1.1.3
|
||||
115,2.1.4
|
||||
116,1.3.1.7
|
||||
117,2.1.1.1
|
||||
117,2.1.1.2
|
||||
117,2.1.1.3
|
||||
117,2.1.1.4
|
||||
117,2.1.1.5
|
||||
117,2.1.4.1.1
|
||||
117,2.1.4.1.2
|
||||
117,2.1.4.1.3
|
||||
117,2.1.4.1.4
|
||||
117,2.1.4.2.1
|
||||
117,2.1.4.2.2
|
||||
118,1.3.3.6
|
||||
119,1.3.1.1
|
||||
120,1.2.3
|
||||
121,1.4.2.4
|
||||
122,1.4.2.6
|
||||
123,1.1.2
|
||||
124,1.2.1
|
||||
124,2.3
|
||||
125,1.2.3
|
||||
126,1.1
|
||||
126,1.2
|
||||
126,1.4
|
||||
126,2.1.1.5
|
||||
126,2.1.3
|
||||
126,2.2
|
||||
126,2.3
|
||||
127,1.1.1
|
||||
127,1.1.3
|
||||
128,1.1.2
|
||||
129,1.1.2
|
||||
129,1.2.3
|
||||
130,1.3.2
|
||||
130,1.3.4.1
|
||||
130,1.3.4.2
|
||||
130,1.3.4.3
|
||||
130,1.3.5
|
||||
131,2.1.1.1
|
||||
131,2.1.1.2
|
||||
131,2.1.1.3
|
||||
131,2.1.1.4
|
||||
131,2.1.1.5
|
||||
132,1.3.3.2
|
||||
133,1.4.1.3
|
||||
133,1.4.4.1
|
||||
134,1.3.3.5
|
||||
135,1.1.3
|
||||
135,1.3.2.1
|
||||
135,1.3.4.1
|
||||
135,2.1.3.1
|
||||
135,2.1.3.2
|
||||
135,2.1.3.3
|
||||
135,2.1.3.4
|
||||
135,2.1.3.5
|
||||
135,2.1.3.6
|
||||
135,2.1.3.7
|
||||
135,2.2
|
||||
136,1.2.1
|
||||
137,2.1.4.1.1
|
||||
137,2.1.4.1.2
|
||||
137,2.1.4.1.3
|
||||
137,2.1.4.1.4
|
||||
137,2.1.4.2.1
|
||||
137,2.1.4.2.2
|
||||
138,1.3.1.5
|
||||
139,1.3.3.7
|
||||
140,1.4.1.1
|
||||
140,1.4.1.4
|
||||
140,1.4.1.5
|
||||
140,1.4.5.1
|
||||
140,1.4.5.3
|
||||
140,1.4.5.4
|
||||
140,1.4.5.9
|
||||
141,1.3.3.2
|
||||
142,1.4.1.1
|
||||
142,1.4.2
|
||||
142,1.4.3
|
||||
143,2.1.1.1
|
||||
143,2.1.1.2
|
||||
143,2.1.1.3
|
||||
143,2.1.1.4
|
||||
143,2.1.1.5
|
||||
144,2.1.2.1
|
||||
144,2.1.2.2
|
||||
144,2.1.2.3
|
||||
144,2.1.2.4
|
||||
145,1.3.1.4
|
||||
146,1.3.1.1
|
||||
147,1.1.2
|
||||
148,2.1.1
|
||||
148,2.1.3
|
||||
148,2.2
|
||||
149,2.1.2.1
|
||||
149,2.1.2.2
|
||||
149,2.1.2.3
|
||||
149,2.1.2.4
|
||||
150,1.1.1
|
||||
151,1.3.5.1
|
||||
152,1.4.4.1
|
||||
153,1.3.1.1
|
||||
153,1.3.1.4
|
||||
154,2.1.4.1.1
|
||||
154,2.1.4.1.2
|
||||
154,2.1.4.1.3
|
||||
154,2.1.4.1.4
|
||||
154,2.1.4.2.1
|
||||
154,2.1.4.2.2
|
||||
155,2.3
|
||||
156,1.3.1.7
|
||||
157,1.4.1
|
||||
158,1.4.4.1
|
||||
159,2.1.2
|
||||
160,1.4.1.3
|
||||
161,2.3.1
|
||||
161,2.3.2
|
||||
161,2.3.3
|
||||
162,1.4.5.6
|
||||
162,1.4.5.7
|
||||
163,2.1.4.1.1
|
||||
163,2.1.4.1.2
|
||||
163,2.1.4.1.3
|
||||
163,2.1.4.1.4
|
||||
163,2.1.4.2.1
|
||||
163,2.1.4.2.2
|
||||
164,1.3.3.6
|
||||
165,2.1.2.1
|
||||
165,2.1.2.2
|
||||
165,2.1.2.3
|
||||
165,2.1.2.4
|
||||
166,1.2.3
|
||||
167,1.1.1
|
||||
168,1.1.2
|
||||
168,1.3.3.1
|
||||
168,1.3.3.2
|
||||
168,1.3.3.4
|
||||
168,2.3.1
|
||||
168,2.3.2
|
||||
168,2.3.3
|
||||
169,1.1.1
|
||||
170,1
|
|
|
@ -2,4 +2,4 @@
|
|||
7,TRUE,TRUE,uniform,5,0.3,3,3
|
||||
5,FALSE,FALSE,normal,10,0.5,5,2
|
||||
3,,,,15,0.7,7,1
|
||||
,,
|
||||
,,,,,
|
|
|
@ -0,0 +1,108 @@
|
|||
Index,Code,Level,Name,产业种类
|
||||
0,1,0,工业互联网,0
|
||||
1,1.1,1,工业自动化硬件,1
|
||||
2,1.1.1,2,工业计算芯片,0
|
||||
3,1.1.2,2,工业控制器,0
|
||||
4,1.1.3,2,工业服务器,0
|
||||
5,1.2,1,工业互联网网络,1
|
||||
6,1.2.1,2,网络互联服务,0
|
||||
7,1.2.2,2,标识解析服务,0
|
||||
8,1.2.3,2,数据互通服务,0
|
||||
9,1.3,1,工业软件,1
|
||||
10,1.3.1,2,设计研发软件,0
|
||||
11,1.3.1.1,3,计算机辅助设计CAD,0
|
||||
12,1.3.1.2,3,计算机辅助工程CAE,0
|
||||
13,1.3.1.3,3,计算机辅助制造CAM,0
|
||||
14,1.3.1.4,3,计算机辅助工艺过程设计CAPP,0
|
||||
15,1.3.1.5,3,产品数据管理PDM,1
|
||||
16,1.3.1.6,3,产品生命周期管理PLM,1
|
||||
17,1.3.1.7,3,电子设计自动化EDA,1
|
||||
18,1.3.2,2,采购供应软件,1
|
||||
19,1.3.2.1,3,供应链管理SCM,1
|
||||
20,1.3.3,2,生产制造软件,1
|
||||
21,1.3.3.1,3,制造执行系统MES,1
|
||||
22,1.3.3.2,3,分布式控制系统DCS,0
|
||||
23,1.3.3.3,3,数据采集与监视控制系统SCADA,1
|
||||
24,1.3.3.4,3,可编程逻揖控制系统PLC,1
|
||||
25,1.3.3.5,3,企业资产管理系统EAM,1
|
||||
26,1.3.3.6,3,运维保障系统MRO,1
|
||||
27,1.3.3.7,3,故障预测与健康管理PHM,1
|
||||
28,1.3.4,2,企业运营管理软件,1
|
||||
29,1.3.4.1,3,企业资源计划ERP,1
|
||||
30,1.3.4.2,3,客户关系管理CRM,1
|
||||
31,1.3.4.3,3,人力资源管理HRM,1
|
||||
32,1.3.5,2,仓储物流软件,0
|
||||
33,1.3.5.1,3,仓储物流管理WMS,1
|
||||
34,1.4,1,工业互联网安全管理,1
|
||||
35,1.4.1,2,设备安全,1
|
||||
36,1.4.1.1,3,工业防火墙,1
|
||||
37,1.4.1.2,3,下一代防火墙,0
|
||||
38,1.4.1.3,3,防毒墙,1
|
||||
39,1.4.1.4,3,入侵检测系统,1
|
||||
40,1.4.1.5,3,统一威胁管理系统,1
|
||||
41,1.4.2,2,控制安全,1
|
||||
42,1.4.2.1,3,工控安全监测与审计,1
|
||||
43,1.4.2.2,3,工控主机卫士,1
|
||||
44,1.4.2.3,3,工控漏洞扫描,0
|
||||
45,1.4.2.4,3,安全隔离与信息交换系统,1
|
||||
46,1.4.2.5,3,安全日志与审计,1
|
||||
47,1.4.2.6,3,隐私计算,1
|
||||
48,1.4.2.7,3,工控原生安全,1
|
||||
49,1.4.3,2,网络安全,1
|
||||
50,1.4.3.1,3,网络漏洞扫描和补丁管理,0
|
||||
51,1.4.3.2,3,流量检测,1
|
||||
52,1.4.3.3,3,APT检测,0
|
||||
53,1.4.3.4,3,攻击溯源,0
|
||||
54,1.4.3.5,3,负载均衡,1
|
||||
55,1.4.3.6,3,沙箱类设备,0
|
||||
56,1.4.4,2,平台安全,1
|
||||
57,1.4.4.1,3,身份鉴别与访问控制,0
|
||||
58,1.4.4.2,3,密钥管理,0
|
||||
59,1.4.4.3,3,接入认证,0
|
||||
60,1.4.4.4,3,工业应用行为监控,1
|
||||
61,1.4.4.5,3,安全态势感知,0
|
||||
62,1.4.5,2,数据安全,0
|
||||
63,1.4.5.1,3,恶意代码检测系统,1
|
||||
64,1.4.5.2,3,数据防泄漏系统,1
|
||||
65,1.4.5.3,3,数据审计系统,0
|
||||
66,1.4.5.4,3,数据脱敏,1
|
||||
67,1.4.5.5,3,敏感数据发现与监控,0
|
||||
68,1.4.5.6,3,数据容灾备份,0
|
||||
69,1.4.5.7,3,数据恢复,1
|
||||
70,1.4.5.8,3,数据加密,1
|
||||
71,1.4.5.9,3,数据防火墙,0
|
||||
72,2,0,工业互联网平台,1
|
||||
73,2.1,1,PaaS,0
|
||||
74,2.1.1,2,开发工具,1
|
||||
75,2.1.1.1,3,算法建模工具,1
|
||||
76,2.1.1.2,3,低代码开发工具,0
|
||||
77,2.1.1.3,3,流程开发工具,1
|
||||
78,2.1.1.4,3,组态建模工具,1
|
||||
79,2.1.1.5,3,数字孪生建模工具,1
|
||||
80,2.1.2,2,工业模型库,1
|
||||
81,2.1.2.1,3,数据算法模型,0
|
||||
82,2.1.2.2,3,业务流程模型,0
|
||||
83,2.1.2.3,3,研发仿真模型,0
|
||||
84,2.1.2.4,3,行业机理模型,1
|
||||
85,2.1.3,2,工业物联网,1
|
||||
86,2.1.3.1,3,物联网服务,0
|
||||
87,2.1.3.2,3,平台基础服务,1
|
||||
88,2.1.3.3,3,工业引擎服务,1
|
||||
89,2.1.3.4,3,应用管理服务,1
|
||||
90,2.1.3.5,3,容器服务,1
|
||||
91,2.1.3.6,3,微服务,1
|
||||
92,2.1.3.7,3,制造类API,0
|
||||
93,2.1.4,2,工业大数据,1
|
||||
94,2.1.4.1,3,工业大数据存储,1
|
||||
95,2.1.4.1.1,4,关系型数据库,0
|
||||
96,2.1.4.1.2,4,分布式数据库,1
|
||||
97,2.1.4.1.3,4,实时数据库,0
|
||||
98,2.1.4.1.4,4,时序数据库,0
|
||||
99,2.1.4.2,3,工业大数据管理,0
|
||||
100,2.1.4.2.1,4,数据质量管理,1
|
||||
101,2.1.4.2.2,4,数据安全管理,1
|
||||
102,2.2,1,IaaS,0
|
||||
103,2.3,1,边缘层,0
|
||||
104,2.3.1,2,工业数据接入,0
|
||||
105,2.3.2,2,边缘数据处理,0
|
||||
106,2.3.3,2,协议转换,1
|
|
|
@ -0,0 +1,171 @@
|
|||
Code,Company Name,原材料,库存商品,设备数量,Revenue,Total Employees (People),Type_Region,Self-supply Business (Yes/No),Revenue_Log,production_output,demand_quantity
|
||||
1,Company_1,284.02,982.67,452.15,29692.44,963,Suburban,Yes,10.298647746934053,204.215,481.402
|
||||
2,Company_2,591.75,232.7,597.47,37552.56,222,Urban,No,10.533496830634064,553.747,253.175
|
||||
3,Company_3,514.2,466.73,388.52,23557.62,355,Urban,No,10.067204613987071,227.852,377.42
|
||||
4,Company_4,893.84,633.71,580.73,89135.78,496,Urban,No,11.397916104118977,221.073,483.384
|
||||
5,Company_5,306.54,844.63,474.67,60818.82,117,Suburban,Yes,11.015654559530484,391.467,209.654
|
||||
6,Company_6,830.89,831.11,177.37,73695.09,279,Rural,No,11.207691454519859,372.737,473.089
|
||||
7,Company_7,483.95,603.67,603.02,73826.05,832,Rural,Yes,11.209466929335226,186.302,485.395
|
||||
8,Company_8,483.1,525.24,116.64,83568.26,242,Rural,Yes,11.333419061909991,437.664,500.31
|
||||
9,Company_9,958.73,267.31,682.18,36015.98,351,Suburban,No,10.491718007837608,433.217,460.873
|
||||
10,Company_10,946.82,215.02,393.99,26255.05,324,Suburban,No,10.175613630469309,472.399,381.682
|
||||
11,Company_11,454.76,689.55,232.49,84782.37,81,Suburban,Yes,11.3478428992222,243.249,260.476
|
||||
12,Company_12,323.83,177.09,624.04,26639.31,170,Suburban,No,10.19014322341799,321.404,148.382
|
||||
13,Company_13,425.17,396.05,274.2,31290.59,265,Rural,No,10.351072692349652,287.42,490.517
|
||||
14,Company_14,109.55,739.42,406.11,87814.36,788,Suburban,No,11.38298031978054,148.611,401.955
|
||||
15,Company_15,202.82,923.13,100.91,43238.15,487,Suburban,No,10.674478486379028,210.091,336.282
|
||||
16,Company_16,160.02,615.97,486.87,32433.19,658,Urban,No,10.386937560174536,327.687,459.002
|
||||
17,Company_17,292.47,762.76,981.28,22436.39,755,Rural,Yes,10.018439473254828,433.128,232.247
|
||||
18,Company_18,331.51,800.32,145.21,65352.83,631,Rural,Yes,11.087556023393986,388.521,358.151
|
||||
19,Company_19,508.01,104.76,862.05,67955.82,579,Rural,No,11.126613067125563,576.205,465.801
|
||||
20,Company_20,484.81,906.52,943.38,70611.44,692,Urban,No,11.164947450014383,325.33799999999997,513.481
|
||||
21,Company_21,769.67,739.38,736.02,76562.51,383,Suburban,Yes,11.245862810333419,455.602,197.96699999999998
|
||||
22,Company_22,533.36,234.46,657.71,38283.05,722,Urban,No,10.552762518463977,416.771,354.336
|
||||
23,Company_23,641.84,872.33,487.84,42673.07,791,Suburban,Yes,10.661323321098049,183.784,208.184
|
||||
24,Company_24,700.51,197.06,621.79,66410.79,503,Urban,No,11.10361482226283,257.179,341.051
|
||||
25,Company_25,628.84,292.82,571.1,72622.08,997,Urban,No,11.19302428680546,240.11,317.884
|
||||
26,Company_26,653.23,970.24,221.15,81298.66,667,Suburban,No,11.305884813235249,382.115,371.323
|
||||
27,Company_27,747.52,130.58,938.29,73435.38,990,Urban,No,11.204161114818818,214.829,339.752
|
||||
28,Company_28,878.41,322.67,211.96,77726.12,556,Rural,No,11.260946644601198,438.196,371.841
|
||||
29,Company_29,758.14,433.16,956.4,33200.84,568,Suburban,No,10.410330455789328,458.64,510.81399999999996
|
||||
30,Company_30,916.25,613.21,455.27,43485.34,347,Rural,No,10.680179148781386,252.527,267.625
|
||||
31,Company_31,900.34,969.81,394.83,50244.63,433,Rural,No,10.824658954539137,373.483,322.034
|
||||
32,Company_32,996.22,755.3,640.05,33162.77,550,Urban,No,10.409183140139199,514.005,450.622
|
||||
33,Company_33,515.17,844.15,161.39,57032.93,853,Rural,Yes,10.951384099299384,272.139,470.517
|
||||
34,Company_34,540.93,578.49,650.09,74078.09,806,Suburban,Yes,11.21287508605031,236.00900000000001,334.093
|
||||
35,Company_35,366.24,940.41,849.01,19617.56,483,Rural,Yes,9.884180362490643,519.901,169.624
|
||||
36,Company_36,405.22,450.03,380.13,11929.17,371,Rural,No,9.386741940165397,290.013,425.522
|
||||
37,Company_37,760.77,517.35,208.94,86851.29,464,Suburban,No,11.371952624754107,145.894,425.077
|
||||
38,Company_38,818.17,404.74,315.82,78053.26,201,Suburban,Yes,11.265146693168688,265.582,258.817
|
||||
39,Company_39,586.03,697.5,155.23,42210.17,931,Suburban,No,10.650416466250073,158.523,523.603
|
||||
40,Company_40,814.27,687.38,477.47,18756.58,673,Urban,Yes,9.839299903169191,295.747,192.427
|
||||
41,Company_41,872.52,234.9,598.33,33207.98,178,Urban,No,10.410545487468179,269.833,469.252
|
||||
42,Company_42,318.98,744.42,671.43,45471.87,404,Rural,No,10.72484917199056,178.143,350.898
|
||||
43,Company_43,453.11,750.88,926.15,99013.81,875,Suburban,No,11.503014614337706,490.615,434.311
|
||||
44,Company_44,130.39,274.92,629.0,13707.42,384,Urban,Yes,9.525692571040127,474.9,479.039
|
||||
45,Company_45,578.76,368.08,890.9,26604.81,901,Rural,No,10.188847305490215,324.09000000000003,202.876
|
||||
46,Company_46,265.4,987.58,137.93,39924.26,335,Suburban,No,10.594739438158781,349.793,331.54
|
||||
47,Company_47,743.33,304.14,867.21,90417.33,567,Urban,Yes,11.412191231547315,371.721,453.33299999999997
|
||||
48,Company_48,873.08,651.74,589.46,49837.92,599,Urban,Yes,10.816531419043114,371.946,299.308
|
||||
49,Company_49,797.72,610.35,866.25,71390.29,680,Urban,Yes,11.17591714468184,317.625,432.772
|
||||
50,Company_50,173.31,403.93,398.59,19134.31,577,Rural,No,9.859238337632949,383.859,427.331
|
||||
51,Company_51,713.05,943.63,786.47,33400.45,814,Suburban,No,10.416324651927923,242.647,554.305
|
||||
52,Company_52,769.5,939.62,827.64,15891.9,622,Urban,No,9.673564824440492,500.764,351.95
|
||||
53,Company_53,424.01,131.65,979.59,68631.67,998,Rural,Yes,11.13650936898853,240.959,315.401
|
||||
54,Company_54,923.68,474.15,214.87,18889.97,631,Suburban,Yes,9.84638637235242,403.487,459.368
|
||||
55,Company_55,671.6,928.96,584.73,93556.96,965,Suburban,No,11.446325727652052,191.473,350.15999999999997
|
||||
56,Company_56,740.88,450.42,624.08,75711.44,741,Rural,Yes,11.234684550861001,524.408,318.08799999999997
|
||||
57,Company_57,409.56,660.05,574.35,30617.71,416,Rural,No,10.32933387869449,211.435,536.956
|
||||
58,Company_58,436.2,294.82,599.98,78445.43,977,Urban,Yes,11.270158502799614,276.998,387.62
|
||||
59,Company_59,516.54,770.6,290.97,37174.96,441,Suburban,Yes,10.523390695335847,419.097,475.654
|
||||
60,Company_60,721.93,305.6,412.97,98848.66,842,Urban,Yes,11.501345272614115,316.297,280.193
|
||||
61,Company_61,712.26,395.66,391.41,92570.96,996,Urban,No,11.435730764537892,151.14100000000002,496.226
|
||||
62,Company_62,498.75,142.06,747.78,71608.94,917,Rural,Yes,11.178975205489529,536.778,380.875
|
||||
63,Company_63,623.33,901.33,397.15,23513.3,567,Suburban,Yes,10.065321497485543,362.715,297.333
|
||||
64,Company_64,263.36,133.88,830.99,20195.09,241,Urban,Yes,9.913194784536234,392.099,319.336
|
||||
65,Company_65,479.22,672.42,688.79,41600.33,951,Suburban,No,10.635863378910198,528.879,334.922
|
||||
66,Company_66,586.48,947.72,733.06,13215.54,624,Rural,Yes,9.489148688859606,487.306,478.648
|
||||
67,Company_67,145.29,158.54,178.11,64118.35,910,Rural,Yes,11.068485873391767,260.811,258.529
|
||||
68,Company_68,267.7,992.49,846.41,83839.88,127,Urban,No,11.336664068256136,552.641,188.77
|
||||
69,Company_69,207.33,621.93,942.4,54187.36,793,Suburban,Yes,10.900202949897876,349.24,518.733
|
||||
70,Company_70,107.17,406.95,154.29,15249.9,383,Suburban,Yes,9.632328224637009,506.429,294.717
|
||||
71,Company_71,835.06,230.35,568.8,91044.0,294,Rural,No,11.419098185126074,318.88,291.506
|
||||
72,Company_72,149.12,861.62,775.5,97301.35,155,Urban,No,11.485568142692438,360.55,156.912
|
||||
73,Company_73,385.5,741.6,846.34,19971.89,201,Rural,Yes,9.902081063894537,205.63400000000001,445.55
|
||||
74,Company_74,363.13,524.32,314.91,46296.94,763,Rural,Yes,10.742831147177496,255.491,284.313
|
||||
75,Company_75,647.69,363.06,973.17,77340.29,460,Urban,No,11.25597031483101,381.317,278.769
|
||||
76,Company_76,439.41,498.97,944.89,30625.18,754,Rural,Yes,10.329577825380776,526.489,258.94100000000003
|
||||
77,Company_77,466.64,397.98,979.11,86794.57,418,Rural,Yes,11.371299341087946,417.911,347.664
|
||||
78,Company_78,641.64,202.48,850.07,29307.04,807,Urban,No,10.285583039181757,259.007,379.164
|
||||
79,Company_79,732.01,600.48,239.65,93479.02,864,Rural,Yes,11.445492305071953,246.965,195.201
|
||||
80,Company_80,922.97,177.28,277.08,83955.43,883,Urban,Yes,11.33804134177189,500.70799999999997,222.297
|
||||
81,Company_81,627.27,621.58,542.03,87676.13,277,Urban,No,11.38140496343402,546.203,518.727
|
||||
82,Company_82,165.15,637.29,220.57,35181.96,313,Urban,Yes,10.468288730213176,371.057,246.515
|
||||
83,Company_83,819.04,221.6,785.02,16422.34,471,Urban,No,9.706397881988158,424.502,273.904
|
||||
84,Company_84,495.01,235.24,793.64,18346.41,797,Suburban,No,9.817189194015675,465.36400000000003,229.501
|
||||
85,Company_85,189.98,626.37,530.14,49793.11,669,Suburban,No,10.815631900027373,492.014,420.998
|
||||
86,Company_86,786.61,983.8,224.61,27511.88,420,Urban,No,10.222373190369527,296.461,200.661
|
||||
87,Company_87,775.36,813.93,242.21,94867.05,336,Rural,Yes,11.460231716720575,458.221,433.536
|
||||
88,Company_88,316.03,569.38,505.27,31548.83,265,Suburban,Yes,10.35929178328807,307.527,299.603
|
||||
89,Company_89,411.42,968.1,873.75,17001.83,274,Suburban,No,9.741076264303647,220.375,534.142
|
||||
90,Company_90,360.91,720.1,917.41,33781.07,582,Suburban,Yes,10.427655865407793,473.741,252.091
|
||||
91,Company_91,358.16,611.27,878.08,94174.16,361,Urban,Yes,11.452901112955821,500.808,146.816
|
||||
92,Company_92,353.58,598.11,973.92,46314.41,797,Suburban,No,10.743208422753485,540.392,251.358
|
||||
93,Company_93,796.81,261.4,254.01,36160.77,589,Suburban,No,10.495730108527182,202.401,310.681
|
||||
94,Company_94,479.78,168.81,256.88,40033.55,561,Rural,No,10.597473131541856,467.688,210.978
|
||||
95,Company_95,500.33,585.43,362.28,58187.29,708,Urban,No,10.971422224990354,253.228,302.033
|
||||
96,Company_96,267.69,499.92,214.82,79427.15,318,Suburban,No,11.282595528333824,179.482,373.769
|
||||
97,Company_97,755.05,985.95,179.24,82469.43,673,Suburban,Yes,11.320182958199297,140.924,446.505
|
||||
98,Company_98,302.62,320.94,594.75,51363.17,367,Suburban,No,10.84667665764297,510.475,362.262
|
||||
99,Company_99,714.96,972.27,684.7,26131.27,620,Rural,No,10.170887960471719,552.47,208.496
|
||||
100,Company_100,945.42,505.3,509.87,57539.11,222,Urban,Yes,10.960220169485046,174.987,338.54200000000003
|
||||
101,Company_101,160.02,165.31,985.52,97438.02,772,Urban,Yes,11.486971762540222,329.552,243.002
|
||||
102,Company_102,445.92,108.59,838.78,65823.19,990,Rural,No,11.094727486834918,310.878,233.59199999999998
|
||||
103,Company_103,591.79,603.5,225.38,17043.42,511,Suburban,Yes,9.74351948447026,211.538,287.179
|
||||
104,Company_104,252.06,450.61,405.59,57402.73,571,Rural,No,10.95784714215228,316.55899999999997,462.206
|
||||
105,Company_105,165.62,951.39,306.5,45833.17,398,Rural,Yes,10.73276334377794,173.65,386.562
|
||||
106,Company_106,255.06,128.16,259.17,13244.48,616,Urban,No,9.491336140837323,395.91700000000003,362.506
|
||||
107,Company_107,447.35,180.41,643.05,70700.8,449,Rural,No,11.166212167237902,476.305,380.735
|
||||
108,Company_108,781.83,434.34,550.93,81277.04,720,Suburban,Yes,11.305618844826347,450.093,377.183
|
||||
109,Company_109,169.85,134.46,977.71,94591.41,473,Suburban,No,11.45732194753443,239.77100000000002,273.985
|
||||
110,Company_110,125.7,708.42,777.62,11615.85,473,Rural,Yes,9.360125823758061,452.762,334.57
|
||||
111,Company_111,866.33,981.73,892.43,14848.63,251,Suburban,Yes,9.605662884082752,436.243,392.63300000000004
|
||||
112,Company_112,725.77,590.82,558.44,15328.79,949,Urban,Yes,9.63748803854849,397.844,518.577
|
||||
113,Company_113,958.57,191.31,188.92,97104.67,310,Urban,Yes,11.483544747870583,305.892,306.85699999999997
|
||||
114,Company_114,729.39,511.32,120.71,69592.56,191,Urban,No,11.150412944056944,457.071,390.93899999999996
|
||||
115,Company_115,365.17,638.89,288.41,18567.32,982,Rural,Yes,9.829158325138039,372.841,401.517
|
||||
116,Company_116,265.79,429.39,476.28,86839.57,716,Urban,No,11.371817672344777,372.628,356.579
|
||||
117,Company_117,559.33,264.97,113.88,15724.66,744,Rural,Yes,9.66298545971327,444.388,394.933
|
||||
118,Company_118,781.96,443.32,862.47,74245.47,273,Rural,No,11.215132044702743,427.247,508.196
|
||||
119,Company_119,890.02,331.77,697.16,83693.72,772,Rural,Yes,11.334919223794108,531.716,428.002
|
||||
120,Company_120,358.86,588.14,768.94,84336.55,101,Urban,No,11.342570620606638,188.894,371.886
|
||||
121,Company_121,589.37,192.81,994.71,30198.07,651,Urban,Yes,10.315533294036035,451.471,426.937
|
||||
122,Company_122,808.28,297.7,455.05,30809.46,875,Urban,Yes,10.335577064660097,157.505,494.828
|
||||
123,Company_123,988.78,307.96,869.8,44511.43,310,Suburban,Yes,10.703501289105592,455.98,326.878
|
||||
124,Company_124,461.81,849.69,521.11,84053.28,549,Suburban,Yes,11.339206162465574,425.111,217.18099999999998
|
||||
125,Company_125,438.73,683.75,458.4,34747.89,771,Rural,Yes,10.455874129724979,386.84,305.873
|
||||
126,Company_126,791.33,299.04,650.17,84231.54,634,Urban,Yes,11.341324714414265,208.017,494.13300000000004
|
||||
127,Company_127,369.59,143.99,204.6,27639.11,536,Rural,Yes,10.22698707765262,338.46,479.959
|
||||
128,Company_128,524.05,885.87,431.91,22997.06,766,Suburban,Yes,10.04312166065388,507.19100000000003,410.405
|
||||
129,Company_129,677.07,490.74,311.48,21524.13,781,Rural,No,9.97692991036063,444.148,564.707
|
||||
130,Company_130,178.2,260.51,858.09,83651.2,562,Rural,No,11.334411051799224,185.809,333.82
|
||||
131,Company_131,691.31,398.92,644.53,87442.53,582,Rural,No,11.378737056558094,443.453,357.131
|
||||
132,Company_132,189.46,575.78,346.71,13257.65,284,Rural,Yes,9.492330023297646,296.671,473.946
|
||||
133,Company_133,488.33,731.67,953.18,26643.92,489,Rural,Yes,10.190316260976394,559.318,406.83299999999997
|
||||
134,Company_134,369.02,465.67,667.29,78924.61,793,Suburban,No,11.27624837201392,238.72899999999998,205.902
|
||||
135,Company_135,738.44,879.57,465.81,92477.88,609,Suburban,No,11.434724759768017,365.581,546.844
|
||||
136,Company_136,758.99,786.45,658.38,52134.69,989,Urban,Yes,10.861585841104548,218.838,231.899
|
||||
137,Company_137,464.53,270.67,133.65,25976.63,552,Suburban,Yes,10.164952566645338,168.365,274.453
|
||||
138,Company_138,580.02,793.08,931.46,40643.76,471,Rural,Yes,10.612600597657721,362.146,444.002
|
||||
139,Company_139,274.51,795.06,500.42,35139.32,233,Rural,Yes,10.46707601038709,281.04200000000003,458.451
|
||||
140,Company_140,959.71,868.21,107.06,49994.95,428,Rural,Yes,10.81967727930944,361.706,578.971
|
||||
141,Company_141,354.71,563.01,350.48,42908.83,610,Urban,No,10.666832911242361,272.048,357.471
|
||||
142,Company_142,396.03,603.89,128.42,39303.37,668,Urban,No,10.579065544817109,332.842,170.603
|
||||
143,Company_143,892.61,311.16,670.46,43027.27,864,Suburban,Yes,10.669589379711221,549.046,279.26099999999997
|
||||
144,Company_144,486.76,626.8,943.16,39879.69,50,Rural,No,10.593622450725602,318.31600000000003,189.676
|
||||
145,Company_145,917.34,288.69,643.88,55254.01,873,Suburban,Yes,10.919696195931778,281.38800000000003,371.73400000000004
|
||||
146,Company_146,435.58,284.0,802.41,14442.55,517,Suburban,Yes,9.577933989653928,362.241,241.558
|
||||
147,Company_147,202.67,381.12,247.09,64747.68,871,Rural,Yes,11.07825314880404,335.709,272.267
|
||||
148,Company_148,394.8,297.97,982.49,64826.8,825,Suburban,No,11.079474377086543,261.249,240.48000000000002
|
||||
149,Company_149,703.7,551.4,223.33,52703.5,186,Rural,No,10.872437145986403,325.333,248.37
|
||||
150,Company_150,271.26,639.62,669.86,54145.21,286,Urban,No,10.899424790529425,392.986,361.126
|
||||
151,Company_151,741.21,534.21,734.27,99208.27,649,Urban,Yes,11.504976656733618,459.427,365.121
|
||||
152,Company_152,946.16,900.51,456.7,12725.19,836,Rural,Yes,9.451338772544975,533.67,282.616
|
||||
153,Company_153,230.74,396.22,221.36,44064.93,469,Rural,No,10.693419506970148,279.136,139.074
|
||||
154,Company_154,390.33,162.83,592.72,41020.68,592,Urban,Yes,10.621831608768346,283.272,484.033
|
||||
155,Company_155,729.59,982.05,479.26,33549.17,191,Suburban,No,10.420767402898578,377.926,280.959
|
||||
156,Company_156,873.45,147.99,568.87,10530.31,621,Urban,No,9.262013044390788,262.887,409.345
|
||||
157,Company_157,799.45,990.69,784.19,76686.49,803,Rural,No,11.247480831032389,299.419,216.945
|
||||
158,Company_158,491.74,143.25,906.25,59283.77,370,Suburban,No,10.990090854439025,558.625,390.174
|
||||
159,Company_159,367.87,208.07,473.62,83903.97,372,Suburban,Yes,11.33742820957182,282.362,264.787
|
||||
160,Company_160,564.46,355.27,733.19,61663.32,609,Urban,No,11.029444543649397,275.319,363.446
|
||||
161,Company_161,607.02,300.46,718.76,99731.85,231,Suburban,No,11.510240363309093,538.876,257.702
|
||||
162,Company_162,363.2,676.84,915.1,81358.78,101,Urban,No,11.306624035526434,493.51,285.32
|
||||
163,Company_163,976.79,481.49,329.12,87221.77,246,Urban,No,11.37620923470151,221.912,377.679
|
||||
164,Company_164,738.36,396.44,379.5,95322.53,249,Rural,No,11.465021473034172,364.95,406.836
|
||||
165,Company_165,785.54,427.37,589.4,84393.08,683,Suburban,No,11.343240686701314,288.94,373.554
|
||||
166,Company_166,992.29,576.28,173.55,43056.45,352,Rural,No,10.670267324417088,470.355,363.229
|
||||
167,Company_167,346.54,528.08,728.16,68761.38,309,Rural,Yes,11.138397529103418,195.816,262.654
|
||||
168,Company_168,523.22,482.95,699.79,58914.32,735,Rural,No,10.983839464028723,344.979,293.322
|
||||
169,Company_169,891.58,418.18,511.08,28763.31,576,Urban,Yes,10.26685589561593,178.108,286.158
|
||||
170,Company_170,712.0,906.86,583.05,16881.59,957,Urban,Yes,9.73397895802674,309.305,519.2
|
|
191
my_model.py
191
my_model.py
|
@ -14,7 +14,6 @@ from product import ProductAgent
|
|||
|
||||
class MyModel(Model):
|
||||
def __init__(self, params):
|
||||
|
||||
# 属性
|
||||
self.is_prf_size = params['prf_size']
|
||||
self.prf_conn = params['prf_conn']
|
||||
|
@ -60,12 +59,15 @@ class MyModel(Model):
|
|||
self.is_prf_size = bool(params['prf_size'])
|
||||
self.remove_t = int(params['remove_t'])
|
||||
self.int_netw_prf_n = int(params['netw_prf_n'])
|
||||
|
||||
# 方法执行
|
||||
self.initialize_product_network(params)
|
||||
self.initialize_firm_network()
|
||||
self.initialize_firm_product_network()
|
||||
self.add_edges_to_firm_network()
|
||||
self.connect_unconnected_nodes()
|
||||
self.resource_integration()
|
||||
self.j_comp_consumed_produced()
|
||||
self.initialize_agents()
|
||||
self.initialize_disruptions()
|
||||
|
||||
|
@ -74,18 +76,33 @@ class MyModel(Model):
|
|||
self.product_network = nx.adjacency_graph(json.loads(params['g_bom']))
|
||||
except Exception as e:
|
||||
print(f"Failed to initialize product network: {e}")
|
||||
# 赋予 产业的量
|
||||
# 产业种类
|
||||
data = pd.read_csv('测试数据 products_materials_equipment.csv')
|
||||
self.type = data
|
||||
# 设备c折旧比值
|
||||
device_salvage_values = pd.read_csv('测试数据 device_salvage_values.csv')
|
||||
self.device_salvage_values = device_salvage_values
|
||||
|
||||
def initialize_firm_network(self):
|
||||
# Read the firm data
|
||||
firm = pd.read_csv("input_data/Firm_amended.csv")
|
||||
|
||||
firm = pd.read_csv("input_data/测试 Firm_amended 170.csv")
|
||||
|
||||
firm['Code'] = firm['Code'].astype('string')
|
||||
firm.fillna(0, inplace=True)
|
||||
firm_attr = firm.loc[:, ["Code", "Type_Region", "Revenue_Log"]]
|
||||
|
||||
firm_attr = firm.loc[:, ["Code", "Type_Region", "Revenue_Log", "原材料", "设备数量", "库存商品"]]
|
||||
|
||||
firm_industry_relation = pd.read_csv("input_data/firm_industry_relation.csv")
|
||||
firm_industry_relation['Firm_Code'] = firm_industry_relation['Firm_Code'].astype('string')
|
||||
|
||||
firm_product = []
|
||||
for _, row in firm.loc[:, '1':].iterrows():
|
||||
firm_product.append(row[row == 1].index.to_list())
|
||||
firm_attr.loc[:, 'Product_Code'] = firm_product
|
||||
|
||||
grouped = firm_industry_relation.groupby('Firm_Code')['Product_Code'].apply(list)
|
||||
firm_product.append(grouped)
|
||||
|
||||
firm_attr['Product_Code'] = firm_attr['Code'].map(grouped)
|
||||
firm_attr.set_index('Code', inplace=True)
|
||||
|
||||
self.G_Firm.add_nodes_from(firm["Code"])
|
||||
|
@ -97,21 +114,15 @@ class MyModel(Model):
|
|||
self.Firm = firm
|
||||
|
||||
def initialize_firm_product_network(self):
|
||||
""" Initialize the firm-product network """
|
||||
# Read the firm-product data
|
||||
Firm_Prod = pd.read_csv("input_data/Firm_amended.csv")
|
||||
Firm_Prod.fillna(0, inplace=True)
|
||||
|
||||
# Stack the firm-product relationships into a DataFrame
|
||||
firm_prod = pd.DataFrame({'bool': Firm_Prod.loc[:, '1':].stack()})
|
||||
firm_prod = firm_prod[firm_prod['bool'] == 1].reset_index()
|
||||
firm_prod.drop('bool', axis=1, inplace=True)
|
||||
firm_prod.rename({'level_0': 'Firm_Code', 'level_1': 'Product_Code'}, axis=1, inplace=True)
|
||||
firm_prod['Firm_Code'] = firm_prod['Firm_Code'].astype('string')
|
||||
firm_industry_relation = pd.read_csv("input_data/firm_industry_relation.csv")
|
||||
firm_industry_relation['Firm_Code'] = firm_industry_relation['Firm_Code'].astype('string')
|
||||
# 将 'firm_prod' 表中的每一行作为图中的节点
|
||||
self.G_FirmProd.add_nodes_from(firm_industry_relation.index)
|
||||
|
||||
self.G_FirmProd.add_nodes_from(firm_prod.index)
|
||||
# Assign attributes to the firm-product nodes
|
||||
firm_prod_labels_dict = {code: firm_prod.loc[code].to_dict() for code in firm_prod.index}
|
||||
# 为每个节点分配属性
|
||||
firm_prod_labels_dict = {code: firm_industry_relation.loc[code].to_dict() for code in
|
||||
firm_industry_relation.index}
|
||||
nx.set_node_attributes(self.G_FirmProd, firm_prod_labels_dict)
|
||||
|
||||
def add_edges_to_firm_network(self):
|
||||
|
@ -204,19 +215,52 @@ class MyModel(Model):
|
|||
def initialize_agents(self):
|
||||
""" Initialize agents and add them to the model. """
|
||||
for ag_node, attr in self.product_network.nodes(data=True):
|
||||
product = ProductAgent(ag_node, self, name=attr['Name'])
|
||||
# 产业种类
|
||||
type2 = self.type.loc[ag_node, '种类']
|
||||
|
||||
device_salvage_values = self.type.loc[ag_node, '设备残值']
|
||||
|
||||
j_comp_data_consumed = self.data_consumed.loc[ag_node]
|
||||
|
||||
j_comp_data_produced = self.data_consumed.loc[ag_node]
|
||||
|
||||
product = ProductAgent(ag_node, self, name=attr['Name'], type2=type2,
|
||||
device_salvage_values=device_salvage_values,
|
||||
j_comp_data_consumed=j_comp_data_consumed,
|
||||
j_comp_data_produced=j_comp_data_produced, )
|
||||
|
||||
self.add_agent(product)
|
||||
# self.grid.place_agent(product, ag_node)
|
||||
|
||||
##print(f"Product agent created: {product.name}, ID: {product.unique_id}")
|
||||
|
||||
for ag_node, attr in self.firm_network.nodes(data=True):
|
||||
a_lst_product = [agent for agent in self.product_agents if agent.unique_id in attr['Product_Code']]
|
||||
|
||||
n_equip_c = self.Firm.loc[ag_node, '设备数量']
|
||||
|
||||
demand_quantity = self.Firm.loc[ag_node, 'production_output']
|
||||
|
||||
production_output = self.Firm.loc[ag_node, 'demand_quantity']
|
||||
|
||||
c_price = self.Firm.loc[ag_node, 'c_price']
|
||||
|
||||
# 资源 资源库存信息 利用 firm_resource
|
||||
R = self.firm_resource_R.loc[ag_node]
|
||||
P = self.firm_resource_R.loc[ag_node]
|
||||
C = self.firm_resource_R.loc[ag_node]
|
||||
|
||||
firm_agent = FirmAgent(
|
||||
ag_node, self,
|
||||
type_region=attr['Type_Region'],
|
||||
revenue_log=attr['Revenue_Log'],
|
||||
n_equip_c=n_equip_c,
|
||||
a_lst_product=a_lst_product,
|
||||
demand_quantity=demand_quantity,
|
||||
production_output=production_output,
|
||||
c_price=c_price,
|
||||
R=R,
|
||||
P=P,
|
||||
C=C
|
||||
)
|
||||
self.add_agent(firm_agent)
|
||||
|
||||
|
@ -258,6 +302,33 @@ class MyModel(Model):
|
|||
elif isinstance(agent, ProductAgent):
|
||||
self.product_agents.append(agent)
|
||||
|
||||
def resource_integration(self):
|
||||
data_R = pd.read_csv("测试数据 companies_materials.csv")
|
||||
data_C = pd.read_csv("测试数据 companies_devices.csv")
|
||||
data_P = pd.read_csv("测试数据 companies_products.csv")
|
||||
firm_resource_R = (data_R.groupby('Firm_Code')[['材料id', '材料数量']]
|
||||
.apply(lambda x: x.values.tolist()))
|
||||
firm_resource_C = (data_C.groupby('Firm_Code')[['材料id', '材料数量']]
|
||||
.apply(lambda x: x.values.tolist()))
|
||||
|
||||
firm_resource_P = (data_P.groupby('Firm_Code')[['材料id', '材料数量']]
|
||||
.apply(lambda x: x.values.tolist()))
|
||||
|
||||
self.firm_resource_R = firm_resource_R
|
||||
self.firm_resource_C = firm_resource_C
|
||||
self.firm_resource_P = firm_resource_P
|
||||
|
||||
def j_comp_consumed_produced(self):
|
||||
data_consumed = pd.read_csv('测试数据 consumed_materials.csv')
|
||||
data_produced = pd.read_csv('测试数据 produced_products.csv')
|
||||
data_consumed = (data_consumed.groupby('产业id')[['消耗材料id', '消耗材料数量']]
|
||||
.apply(lambda x: x.values.tolist()))
|
||||
data_produced = (data_produced.groupby('产业id')[['制造产品id', '制造产品数量']]
|
||||
.apply(lambda x: x.values.tolist()))
|
||||
|
||||
self.data_consumed = data_consumed
|
||||
self.data_produced = data_produced
|
||||
|
||||
def step(self):
|
||||
# 1. Remove edge to customer and disrupt customer up product
|
||||
for firm in self.company_agents:
|
||||
|
@ -303,5 +374,83 @@ class MyModel(Model):
|
|||
for firm in self.company_agents:
|
||||
firm.clean_before_trial()
|
||||
|
||||
# 3. 判断是否需要购买资源 判断是否需要购买机器
|
||||
purchase_material_firms = {}
|
||||
purchase_machinery_firms = {}
|
||||
material_list = []
|
||||
machinery_list = []
|
||||
list_seek_material_firm = [] # 每一个收到请求的企业
|
||||
list_seek_machinery_firm = [] # 每一个收到请求的企业
|
||||
for firm in self.company_agents:
|
||||
# 资源
|
||||
for sub_list in firm.R:
|
||||
if sub_list[1] <= firm.s_r:
|
||||
required_material_quantity = firm.S_r - sub_list[1]
|
||||
(material_list
|
||||
.append([sub_list[0], required_material_quantity]))
|
||||
purchase_material_firms[firm] = material_list
|
||||
# 设备
|
||||
for sub_list in firm.C:
|
||||
# 对于设备的required_machinery_quantity 要有所改变 根据残值而言! 每一个周期固定减少残值值 x firm 里面定义
|
||||
sub_list[2] -= firm.x
|
||||
if sub_list[2] <= 0: # 残值小于等于 0 时
|
||||
sub_list[1] -= 1
|
||||
required_machinery_quantity = firm.C1[0][1] - sub_list[1] # 补回原来的量 也就是 1
|
||||
(machinery_list
|
||||
.append([sub_list[0], required_machinery_quantity]))
|
||||
purchase_machinery_firms[firm] = machinery_list
|
||||
|
||||
# 寻源并发送请求 决定是否接受供应 并更新
|
||||
|
||||
for material_firm, sub_list in purchase_material_firms:
|
||||
for material_list in sub_list:
|
||||
(list_seek_material_firm
|
||||
.append(material_firm.seek_material_supply(material_list[0])))
|
||||
if len(list_seek_material_firm) != 0:
|
||||
for seek_material_firm in list_seek_material_firm:
|
||||
seek_material_firm.handle_material_request(material_list) # 更新产品
|
||||
for R_list in firm.R:
|
||||
R_list[1] = firm.S_r
|
||||
|
||||
for machinery_firm, sub_list in purchase_machinery_firms:
|
||||
for machinery_list in sub_list:
|
||||
(list_seek_machinery_firm
|
||||
.append(machinery_firm.seek_machinery_supply(machinery_list[0])))
|
||||
if len(list_seek_machinery_firm) != 0:
|
||||
for seek_machinery_firm in list_seek_machinery_firm:
|
||||
seek_machinery_firm.handle_machinery_request(machinery_list)
|
||||
for C_list, C0_list in zip(firm.C, firm.C0):
|
||||
C_list[1] = C0_list[1] # 赋值回去
|
||||
C_list[2] = C0_list[2]
|
||||
|
||||
# 消耗资源过程
|
||||
consumed_material = []
|
||||
for product in firm.a_lst_product:
|
||||
for sub_list_data_consumed in product.j_comp_data_consumed:
|
||||
consumed_material_id = sub_list_data_consumed[0]
|
||||
consumed_material_num = sub_list_data_consumed[1]
|
||||
consumed_material.append([consumed_material_id, consumed_material_num])
|
||||
for sub_list_consumed_material in consumed_material:
|
||||
for sub_list_material in firm.R:
|
||||
if sub_list_material[0] == sub_list_consumed_material[0]:
|
||||
sub_list_material[1] = sub_list_material[1] - sub_list_consumed_material[1]
|
||||
# 生产产品过程
|
||||
produced_products = []
|
||||
for product in firm.a_lst_product:
|
||||
for sub_list_produced_products in product.j_comp_data_consumed:
|
||||
produced_products_id = sub_list_produced_products[0]
|
||||
produced_products_num = sub_list_produced_products[1]
|
||||
produced_products.append([produced_products_id, produced_products_num])
|
||||
for sub_list_data_produced_products in produced_products:
|
||||
for sub_list_products in firm.P:
|
||||
if sub_list_products[0] == sub_list_data_produced_products[0]:
|
||||
sub_list_products[1] = sub_list_products[1] - sub_list_data_produced_products[1]
|
||||
# 刷新 R状态
|
||||
firm.refresh_R()
|
||||
# 刷新 C状态
|
||||
firm.refresh_C()
|
||||
# 刷新 P状态
|
||||
firm.refresh_P()
|
||||
|
||||
# Increment the time step
|
||||
self.t += 1
|
||||
|
|
12
product.py
12
product.py
|
@ -1,13 +1,22 @@
|
|||
from mesa import Agent
|
||||
|
||||
|
||||
class ProductAgent(Agent):
|
||||
def __init__(self, unique_id, model, name):
|
||||
def __init__(self, unique_id, model, name, type2, device_salvage_values, j_comp_data_consumed, j_comp_data_produced):
|
||||
# 调用超类的 __init__ 方法
|
||||
super().__init__(unique_id, model)
|
||||
|
||||
# 初始化代理属性
|
||||
self.name = name
|
||||
self.product_network = self.model.product_network
|
||||
if type2 == 0:
|
||||
self.is_equip = True
|
||||
else:
|
||||
self.is_mater = True
|
||||
self.device_salvage_values = device_salvage_values
|
||||
|
||||
self.j_comp_data_produced = j_comp_data_produced
|
||||
self.j_comp_data_consumed = j_comp_data_consumed
|
||||
|
||||
def a_successors(self):
|
||||
# 从 product_network 中找到当前代理的后继节点
|
||||
|
@ -22,4 +31,3 @@ class ProductAgent(Agent):
|
|||
|
||||
# 通过 unique_id 查找前驱节点对应的代理对象,直接从 self.product_agents 列表中获取
|
||||
return [agent for agent in self.model.product_agents if agent.unique_id in predecessors]
|
||||
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# 设置随机种子
|
||||
np.random.seed(42)
|
||||
|
||||
# 生成企业和设备数据
|
||||
num_rows = 10 # 每个表的行数
|
||||
|
||||
# 构造数据
|
||||
company_ids = np.random.randint(1000, 1100, size=num_rows)
|
||||
device_ids = np.random.randint(100, 200, size=num_rows)
|
||||
material_ids = np.random.randint(0, 100, size=num_rows)
|
||||
product_ids = np.random.randint(0, 200, size=num_rows)
|
||||
|
||||
device_quantities = np.random.randint(50, 200, size=num_rows)
|
||||
material_quantities = np.random.randint(100,200, size=num_rows)
|
||||
product_quantities = np.random.randint(20, 100, size=num_rows)
|
||||
|
||||
# 创建三个表格的数据框
|
||||
df_devices = pd.DataFrame({
|
||||
'企业id': company_ids,
|
||||
'设备id': device_ids,
|
||||
'设备数量': device_quantities
|
||||
})
|
||||
|
||||
df_materials = pd.DataFrame({
|
||||
'企业id': company_ids,
|
||||
'材料id': material_ids,
|
||||
'材料数量': material_quantities
|
||||
})
|
||||
|
||||
df_products = pd.DataFrame({
|
||||
'企业id': company_ids,
|
||||
'产品id': product_ids,
|
||||
'产品数量': product_quantities
|
||||
})
|
||||
|
||||
# 保存为CSV文件
|
||||
df_devices.to_csv('测试数据 companies_devices.csv', index=False)
|
||||
df_materials.to_csv('测试数据 companies_materials.csv', index=False)
|
||||
df_products.to_csv('测试数据 companies_products.csv', index=False)
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# 设置随机种子,确保结果可重复
|
||||
np.random.seed(42)
|
||||
|
||||
# 定义产业数量
|
||||
num_industries = 10
|
||||
|
||||
# 创建产业ID列表
|
||||
industry_ids = [i for i in range(0, num_industries + 1)]
|
||||
|
||||
# 为每个产业生成随机的材料id、消耗量、产品id和制造量
|
||||
consumed_materials_data = []
|
||||
produced_products_data = []
|
||||
|
||||
for industry in industry_ids:
|
||||
# 每个产业消耗的材料(生成1到3个随机材料ID和消耗量)
|
||||
num_materials = np.random.randint(1, 4)
|
||||
for _ in range(num_materials):
|
||||
material_id = np.random.randint(0, 100)
|
||||
consumption_quantity = np.random.randint(50, 500)
|
||||
consumed_materials_data.append([industry, material_id, consumption_quantity])
|
||||
|
||||
# 每个产业制造的产品(生成1到3个随机产品ID和制造量)
|
||||
num_products = np.random.randint(1, 4)
|
||||
for _ in range(num_products):
|
||||
product_id = np.random.randint(100, 201)
|
||||
production_quantity = np.random.randint(100, 1000)
|
||||
produced_products_data.append([industry, product_id, production_quantity])
|
||||
|
||||
# 创建两个数据框
|
||||
df_consumed_materials = pd.DataFrame(consumed_materials_data, columns=['产业ID', '消耗材料ID', '消耗量'])
|
||||
df_produced_products = pd.DataFrame(produced_products_data, columns=['产业ID', '制造产品ID', '制造量'])
|
||||
|
||||
# 保存两个数据框为CSV文件
|
||||
file_path_consumed = '测试数据 consumed_materials.csv'
|
||||
file_path_produced = '测试数据 produced_products.csv'
|
||||
|
||||
df_consumed_materials.to_csv(file_path_consumed, index=False)
|
||||
df_produced_products.to_csv(file_path_produced, index=False)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import pandas as pd
|
||||
import random
|
||||
import numpy as np
|
||||
|
||||
# 生成170条测试数据的函数
|
||||
data=pd.read_csv('input_data/BomNodes.csv')
|
||||
# 生成数据
|
||||
df = pd.DataFrame(data)
|
||||
df['产业种类'] = [random.choice([0, 1]) for _ in range(107)]
|
||||
|
||||
# 显示前几行
|
||||
print(df.head())
|
||||
|
||||
# 保存数据到CSV文件
|
||||
df.to_csv('input_data/测试 BomNodes.csv', index=False)
|
|
@ -0,0 +1,36 @@
|
|||
import pandas as pd
|
||||
import random
|
||||
import numpy as np
|
||||
|
||||
|
||||
# 生成170条测试数据的函数
|
||||
def generate_test_data(num_rows=170):
|
||||
data = {
|
||||
'Company ID': [i for i in range(1, num_rows + 1)], # 生成1到170的公司ID
|
||||
'Company Name': [f'Company_{i}' for i in range(1, num_rows + 1)], # 生成公司名称
|
||||
'原材料': [round(random.uniform(100, 1000), 2) for _ in range(num_rows)], # 原材料
|
||||
'库存商品': [round(random.uniform(100, 1000), 2) for _ in range(num_rows)], # 库存商品
|
||||
'固定资产原值': [round(random.uniform(100, 1000), 2) for _ in range(num_rows)], # 固定资产原值
|
||||
'Revenue': [round(random.uniform(10000, 100000), 2) for _ in range(num_rows)], # Revenue
|
||||
'Total Employees (People)': [random.randint(50, 1000) for _ in range(num_rows)], # 员工总数
|
||||
'Type_Region': [random.choice(['Urban', 'Rural', 'Suburban']) for _ in range(num_rows)], # 区域类型
|
||||
'Self-supply Business (Yes/No)': [random.choice(['Yes', 'No']) for _ in range(num_rows)] # 自营业务
|
||||
}
|
||||
|
||||
df = pd.DataFrame(data)
|
||||
|
||||
# 添加Revenue_Log列
|
||||
df['Revenue_Log'] = np.log(df['Revenue'])
|
||||
df['production_output'] = df['固定资产原值'] / 10+np.random.randint(100, 500, size=len(df))
|
||||
df['demand_quantity'] = df['原材料'] / 10 +np.random.randint(100, 500, size=len(df))
|
||||
return df
|
||||
|
||||
|
||||
# 生成数据
|
||||
df_test_data = generate_test_data()
|
||||
|
||||
# 显示前几行
|
||||
print(df_test_data.head())
|
||||
|
||||
# 保存数据到CSV文件
|
||||
df_test_data.to_csv('input_data/测试 Firm_amended 170.csv', index=False)
|
|
@ -0,0 +1,11 @@
|
|||
企业id,设备id,设备数量
|
||||
1051,187,104
|
||||
1092,199,113
|
||||
1014,123,180
|
||||
1071,102,100
|
||||
1060,121,184
|
||||
1020,152,70
|
||||
1082,101,122
|
||||
1086,187,67
|
||||
1074,129,181
|
||||
1074,137,138
|
|
|
@ -0,0 +1,11 @@
|
|||
企业id,材料id,材料数量
|
||||
1051,1,159
|
||||
1092,63,113
|
||||
1014,59,108
|
||||
1071,20,189
|
||||
1060,32,152
|
||||
1020,75,101
|
||||
1082,57,183
|
||||
1086,21,191
|
||||
1074,88,159
|
||||
1074,48,170
|
|
|
@ -0,0 +1,11 @@
|
|||
企业id,产品id,产品数量
|
||||
1051,58,63
|
||||
1092,169,27
|
||||
1014,187,66
|
||||
1071,14,54
|
||||
1060,189,97
|
||||
1020,189,55
|
||||
1082,174,69
|
||||
1086,189,23
|
||||
1074,50,21
|
||||
1074,107,25
|
|
|
@ -0,0 +1,24 @@
|
|||
产业ID,消耗材料ID,消耗量
|
||||
0,51,398
|
||||
0,14,156
|
||||
0,71,238
|
||||
1,74,137
|
||||
1,99,409
|
||||
1,23,180
|
||||
2,37,435
|
||||
2,63,493
|
||||
3,21,302
|
||||
3,88,98
|
||||
4,61,224
|
||||
4,61,100
|
||||
5,72,216
|
||||
6,8,395
|
||||
6,52,435
|
||||
7,80,469
|
||||
7,49,409
|
||||
8,62,451
|
||||
9,47,320
|
||||
9,71,264
|
||||
9,61,345
|
||||
10,52,329
|
||||
10,25,266
|
|
|
@ -0,0 +1,11 @@
|
|||
设备id,设备残值
|
||||
151,97
|
||||
192,382
|
||||
114,109
|
||||
171,881
|
||||
160,673
|
||||
120,140
|
||||
182,671
|
||||
186,318
|
||||
174,779
|
||||
174,353
|
|
|
@ -0,0 +1,101 @@
|
|||
材料id,设备id,产品id
|
||||
51,192,14
|
||||
71,160,20
|
||||
82,186,74
|
||||
74,187,116
|
||||
99,123,130
|
||||
21,152,1
|
||||
87,129,37
|
||||
1,163,187
|
||||
20,132,57
|
||||
21,188,48
|
||||
90,158,169
|
||||
91,159,14
|
||||
61,161,174
|
||||
61,150,107
|
||||
54,163,130
|
||||
50,106,20
|
||||
72,138,17
|
||||
3,188,59
|
||||
13,108,89
|
||||
52,101,83
|
||||
91,159,198
|
||||
43,107,174
|
||||
34,177,80
|
||||
35,149,103
|
||||
3,101,133
|
||||
53,103,190
|
||||
17,189,43
|
||||
33,173,189
|
||||
99,113,94
|
||||
47,114,199
|
||||
77,186,189
|
||||
39,184,81
|
||||
52,123,153
|
||||
88,159,123
|
||||
40,128,14
|
||||
44,164,88
|
||||
70,108,87
|
||||
0,107,62
|
||||
10,180,135
|
||||
34,134,32
|
||||
4,140,27
|
||||
6,172,71
|
||||
11,133,32
|
||||
47,122,61
|
||||
87,136,98
|
||||
43,185,34
|
||||
64,198,100
|
||||
46,177,130
|
||||
0,104,141
|
||||
26,108,14
|
||||
89,141,123
|
||||
76,150,62
|
||||
95,151,131
|
||||
93,200,150
|
||||
14,142,28
|
||||
35,112,159
|
||||
70,158,85
|
||||
27,165,169
|
||||
44,161,184
|
||||
5,127,27
|
||||
43,183,29
|
||||
61,174,127
|
||||
91,188,189
|
||||
96,100,120
|
||||
26,161,120
|
||||
76,102,197
|
||||
71,126,136
|
||||
61,136,50
|
||||
43,123,58
|
||||
31,195,179
|
||||
61,157,51
|
||||
11,138,129
|
||||
2,200,112
|
||||
55,180,186
|
||||
1,101,53
|
||||
86,200,128
|
||||
18,101,52
|
||||
43,189,159
|
||||
69,131,67
|
||||
54,174,183
|
||||
16,137,23
|
||||
68,197,138
|
||||
15,196,200
|
||||
58,169,92
|
||||
2,119,186
|
||||
35,118,89
|
||||
66,118,147
|
||||
95,170,51
|
||||
32,139,127
|
||||
38,181,103
|
||||
0,110,184
|
||||
88,149,150
|
||||
30,193,41
|
||||
98,106,143
|
||||
89,159,112
|
||||
1,100,47
|
||||
11,168,36
|
||||
31,108,98
|
||||
18,147,130
|
||||
19,123,53
|
|
|
@ -0,0 +1,22 @@
|
|||
产业ID,制造产品ID,制造量
|
||||
0,182,314
|
||||
1,152,869
|
||||
1,187,591
|
||||
2,132,559
|
||||
3,158,610
|
||||
3,141,575
|
||||
3,159,882
|
||||
4,163,604
|
||||
4,102,584
|
||||
4,150,746
|
||||
5,103,700
|
||||
5,159,113
|
||||
6,159,554
|
||||
6,143,608
|
||||
6,107,134
|
||||
7,105,665
|
||||
7,103,921
|
||||
8,143,261
|
||||
8,173,369
|
||||
9,179,848
|
||||
10,140,256
|
|
|
@ -0,0 +1,101 @@
|
|||
产品id,种类
|
||||
1,材料
|
||||
2,材料
|
||||
3,材料
|
||||
4,材料
|
||||
5,材料
|
||||
6,材料
|
||||
7,材料
|
||||
8,材料
|
||||
9,材料
|
||||
10,材料
|
||||
11,材料
|
||||
12,材料
|
||||
13,材料
|
||||
14,材料
|
||||
15,材料
|
||||
16,材料
|
||||
17,材料
|
||||
18,材料
|
||||
19,材料
|
||||
20,材料
|
||||
21,材料
|
||||
22,材料
|
||||
23,材料
|
||||
24,材料
|
||||
25,材料
|
||||
26,材料
|
||||
27,材料
|
||||
28,材料
|
||||
29,材料
|
||||
30,材料
|
||||
31,材料
|
||||
32,材料
|
||||
33,材料
|
||||
34,材料
|
||||
35,材料
|
||||
36,材料
|
||||
37,材料
|
||||
38,材料
|
||||
39,材料
|
||||
40,材料
|
||||
41,材料
|
||||
42,材料
|
||||
43,材料
|
||||
44,材料
|
||||
45,材料
|
||||
46,材料
|
||||
47,材料
|
||||
48,材料
|
||||
49,材料
|
||||
50,材料
|
||||
51,材料
|
||||
52,材料
|
||||
53,材料
|
||||
54,材料
|
||||
55,材料
|
||||
56,材料
|
||||
57,材料
|
||||
58,材料
|
||||
59,材料
|
||||
60,材料
|
||||
61,材料
|
||||
62,设备
|
||||
63,设备
|
||||
64,设备
|
||||
65,设备
|
||||
66,设备
|
||||
67,设备
|
||||
68,设备
|
||||
69,设备
|
||||
70,设备
|
||||
71,设备
|
||||
72,设备
|
||||
73,设备
|
||||
74,设备
|
||||
75,设备
|
||||
76,设备
|
||||
77,设备
|
||||
78,设备
|
||||
79,设备
|
||||
80,设备
|
||||
81,设备
|
||||
82,设备
|
||||
83,设备
|
||||
84,设备
|
||||
85,设备
|
||||
86,设备
|
||||
87,设备
|
||||
88,设备
|
||||
89,设备
|
||||
90,设备
|
||||
91,设备
|
||||
92,设备
|
||||
93,设备
|
||||
94,设备
|
||||
95,设备
|
||||
96,设备
|
||||
97,设备
|
||||
98,设备
|
||||
99,设备
|
||||
100,设备
|
|
|
@ -0,0 +1,25 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# 设置数据行数
|
||||
total_rows = 100 # 总共100行
|
||||
material_count = 61 # 前61行为材料
|
||||
|
||||
# 生成产品id
|
||||
product_ids = np.arange(1, total_rows + 1)
|
||||
|
||||
# 生成种类,前61行是材料,后面是设备
|
||||
categories = ['材料'] * material_count + ['设备'] * (total_rows - material_count)
|
||||
|
||||
# 创建数据框
|
||||
df_products = pd.DataFrame({
|
||||
'产品id': product_ids,
|
||||
'种类': categories
|
||||
})
|
||||
|
||||
# 保存为CSV文件
|
||||
file_path_products = '测试数据 products_materials_equipment.csv'
|
||||
df_products.to_csv(file_path_products, index=False) # index=False 不保存行索引
|
||||
|
||||
# 打印文件路径
|
||||
print(f"CSV 文件已生成,路径为: {file_path_products}")
|
|
@ -0,0 +1,42 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# 设置随机种子,以便结果可重复
|
||||
np.random.seed(42)
|
||||
|
||||
# 定义生成数据的行数
|
||||
num_rows = 100 # 生成 100 行数据
|
||||
|
||||
# 创建空列表来存储生成的ID
|
||||
material_ids = []
|
||||
device_ids = []
|
||||
product_ids = []
|
||||
|
||||
# 生成材料、设备、产品的ID,确保同一行内的ID不重复
|
||||
for _ in range(num_rows):
|
||||
mat_id = np.random.randint(0, 100) # 材料ID范围 0-99
|
||||
dev_id = np.random.randint(100, 201) # 设备ID范围 100-199
|
||||
|
||||
# 确保产品ID在当前行与材料ID和设备ID不重复
|
||||
while True:
|
||||
prod_id = np.random.randint(0, 201)
|
||||
if prod_id != mat_id and prod_id != dev_id:
|
||||
break
|
||||
|
||||
material_ids.append(mat_id)
|
||||
device_ids.append(dev_id)
|
||||
product_ids.append(prod_id)
|
||||
|
||||
# 创建数据框,将三个ID列结合起来
|
||||
df_ids = pd.DataFrame({
|
||||
'材料id': material_ids,
|
||||
'设备id': device_ids,
|
||||
'产品id': product_ids
|
||||
})
|
||||
|
||||
# 指定文件路径并保存为CSV文件
|
||||
file_path_ids = '测试数据 material_device_product_ids.csv'
|
||||
df_ids.to_csv(file_path_ids, index=False) # index=False 表示不保存行索引
|
||||
|
||||
# 打印文件路径
|
||||
print(f"CSV 文件已生成,路径为: {file_path_ids}")
|
|
@ -0,0 +1,25 @@
|
|||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
# 设置随机种子以确保结果可重复
|
||||
np.random.seed(42)
|
||||
|
||||
# 定义行数,即生成多少个设备
|
||||
num_rows = 10
|
||||
|
||||
# 生成设备id(例如100到200之间的设备ID)
|
||||
device_ids = np.random.randint(100, 200, size=num_rows)
|
||||
|
||||
# 生成设备残值,假设范围在1000到10000之间
|
||||
device_salvage_values = np.random.randint(10, 1000, size=num_rows)
|
||||
|
||||
# 创建数据框,将设备id和设备残值结合起来
|
||||
df_devices = pd.DataFrame({
|
||||
'设备id': device_ids,
|
||||
'设备残值': device_salvage_values
|
||||
})
|
||||
|
||||
# 保存为CSV文件
|
||||
file_path_devices = '测试数据 device_salvage_values.csv'
|
||||
df_devices.to_csv(file_path_devices, index=False)
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import pandas as pd
|
||||
|
||||
Firm_Prod = pd.read_csv("input_data/Firm_amended.csv")
|
||||
Firm_Prod.fillna(0, inplace=True)
|
||||
|
||||
# Stack the firm-product relationships into a DataFrame
|
||||
firm_prod = pd.DataFrame({'bool': Firm_Prod.loc[:, '1':].stack()})
|
||||
firm_prod = firm_prod[firm_prod['bool'] == 1].reset_index()
|
||||
firm_prod.drop('bool', axis=1, inplace=True)
|
||||
firm_prod.rename({'level_0': 'Firm_Code', 'level_1': 'Product_Code'}, axis=1, inplace=True)
|
||||
firm_prod['Firm_Code'] = firm_prod['Firm_Code'].astype('string')
|
||||
|
||||
# 保存为新的 CSV 文件
|
||||
output_file_path = 'input_data/firm_industry_relation.csv'
|
||||
firm_prod.to_csv(output_file_path, index=False)
|
||||
|
||||
print(f"新的 CSV 文件已保存到: {output_file_path}")
|
Loading…
Reference in New Issue