遗传002
This commit is contained in:
parent
dfd5c5b32d
commit
a6b06735f6
Binary file not shown.
|
|
@ -0,0 +1,10 @@
|
||||||
|
# read by orm
|
||||||
|
is_local_db: True
|
||||||
|
|
||||||
|
local:
|
||||||
|
user_name: iiabm_user
|
||||||
|
password: iiabm_pwd
|
||||||
|
db_name: iiabmdb_20250925
|
||||||
|
address: 'localhost'
|
||||||
|
port: 3306
|
||||||
|
|
||||||
|
|
@ -8,5 +8,5 @@ test: # only for test scenarios
|
||||||
n_iter: 100
|
n_iter: 100
|
||||||
|
|
||||||
not_test: # normal scenarios
|
not_test: # normal scenarios
|
||||||
n_sample: 5
|
n_sample: 1
|
||||||
n_iter: 10
|
n_iter: 10
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"pop_size": 5,
|
"pop_size": 10,
|
||||||
"n_gen": 5,
|
"n_gen": 5,
|
||||||
"n_var": 12,
|
"n_var": 12,
|
||||||
"bound_min": -5,
|
"bound_min": -5,
|
||||||
|
|
|
||||||
|
|
@ -1,204 +1,198 @@
|
||||||
id_firm,count
|
id_firm,count
|
||||||
214851100,1722
|
214851100,350
|
||||||
3111603340,1654
|
3111603340,340
|
||||||
70634828,1548
|
70634828,340
|
||||||
25980377,643
|
25980377,140
|
||||||
340093034,616
|
395736790,136
|
||||||
395736790,607
|
340093034,133
|
||||||
3330358736,567
|
3330358736,120
|
||||||
29223617,564
|
29223617,119
|
||||||
303926772,494
|
532328014,100
|
||||||
532328014,488
|
303926772,99
|
||||||
331545755,339
|
2326722141,72
|
||||||
2337727838,333
|
331545755,71
|
||||||
2326722141,332
|
2337727838,70
|
||||||
3191869223,272
|
3191869223,58
|
||||||
728969035,240
|
591350440,50
|
||||||
2327605629,237
|
2327605629,47
|
||||||
591350440,232
|
517675473,46
|
||||||
517675473,226
|
2336923756,46
|
||||||
2336923756,223
|
728969035,41
|
||||||
16116663,205
|
2349705416,41
|
||||||
2349705416,196
|
16210433,39
|
||||||
16210433,168
|
16116663,37
|
||||||
471121089,168
|
2349179532,34
|
||||||
2349179532,167
|
471121089,29
|
||||||
1452048,22
|
1452048,5
|
||||||
515770253,15
|
515770253,3
|
||||||
2349345463,10
|
2349345463,2
|
||||||
495782506,10
|
6,2
|
||||||
300186799,10
|
5971532,2
|
||||||
3312358902,10
|
1,2
|
||||||
33822284,10
|
5849940,2
|
||||||
2728939,10
|
2424229017,2
|
||||||
420984285,10
|
495782506,2
|
||||||
6,10
|
420984285,2
|
||||||
37873062,10
|
300186799,2
|
||||||
3226664625,10
|
37873062,2
|
||||||
1,10
|
3392803162,2
|
||||||
80158773,10
|
33822284,2
|
||||||
78979697,10
|
3312358902,2
|
||||||
8,10
|
2728939,2
|
||||||
169978927,9
|
3226664625,2
|
||||||
5849940,9
|
79938367,2
|
||||||
3392803162,8
|
78979697,2
|
||||||
11807506,8
|
14913649,2
|
||||||
79938367,8
|
80158773,2
|
||||||
5971532,8
|
8,2
|
||||||
2424229017,8
|
11807506,2
|
||||||
314846874,7
|
169978927,2
|
||||||
14913649,6
|
4607820,1
|
||||||
3462551351,5
|
441623911,1
|
||||||
872394725,5
|
367669349,1
|
||||||
35404067,5
|
410030851,1
|
||||||
805940123,5
|
395739442,1
|
||||||
3362063909,5
|
808524154,1
|
||||||
3358892171,5
|
38852110,1
|
||||||
862404568,5
|
385766513,1
|
||||||
6333996,5
|
8114841,1
|
||||||
9032550,5
|
382080545,1
|
||||||
367669349,5
|
466148111,1
|
||||||
3268669333,5
|
805940123,1
|
||||||
950849442,5
|
675729777,1
|
||||||
3226232,5
|
863973253,1
|
||||||
3203980088,5
|
35404067,1
|
||||||
3195293647,5
|
3462551351,1
|
||||||
31732840,5
|
3429928077,1
|
||||||
961017,5
|
3420061649,1
|
||||||
3151377261,5
|
340603317,1
|
||||||
3147958370,5
|
872394725,1
|
||||||
9620005,5
|
9032550,1
|
||||||
10437056,5
|
907433543,1
|
||||||
907433543,5
|
950849442,1
|
||||||
382080545,5
|
3378606529,1
|
||||||
598808584,5
|
3362063909,1
|
||||||
676597455,5
|
3358892171,1
|
||||||
640700057,5
|
961017,1
|
||||||
644252759,5
|
9620005,1
|
||||||
596368303,5
|
862404568,1
|
||||||
59234665,5
|
493002466,1
|
||||||
648145286,5
|
668539285,1
|
||||||
668539285,5
|
507827038,1
|
||||||
675729777,5
|
676597455,1
|
||||||
578803019,5
|
688155470,1
|
||||||
3118140206,5
|
664591135,1
|
||||||
551856519,5
|
648145286,1
|
||||||
543470507,5
|
644252759,1
|
||||||
688155470,5
|
643954924,1
|
||||||
385766513,5
|
640700057,1
|
||||||
71271700,5
|
6333996,1
|
||||||
733657390,5
|
618469306,1
|
||||||
737770776,5
|
696450846,1
|
||||||
507827038,5
|
71271700,1
|
||||||
756272716,5
|
733657390,1
|
||||||
758879940,5
|
3268669333,1
|
||||||
4607820,5
|
5979030,1
|
||||||
441623911,5
|
737770776,1
|
||||||
771821595,5
|
742704658,1
|
||||||
410030851,5
|
596368303,1
|
||||||
38852110,5
|
59234665,1
|
||||||
562681526,5
|
756272716,1
|
||||||
9746245,5
|
758879940,1
|
||||||
26487185,5
|
578803019,1
|
||||||
197362120,5
|
562681526,1
|
||||||
2333843479,5
|
551856519,1
|
||||||
25685135,5
|
543470507,1
|
||||||
247297633,5
|
762501019,1
|
||||||
2448521375,5
|
771821595,1
|
||||||
2353549582,5
|
518871190,1
|
||||||
2353389310,5
|
778745779,1
|
||||||
2352421906,5
|
78576577,1
|
||||||
205960791,5
|
598808584,1
|
||||||
2351592628,5
|
314846874,1
|
||||||
225958786,5
|
3226232,1
|
||||||
2350443114,5
|
2333843479,1
|
||||||
2310406050,5
|
2310534839,1
|
||||||
2310534839,5
|
2311838590,1
|
||||||
2349742676,5
|
2314659369,1
|
||||||
2349588257,5
|
2316150629,1
|
||||||
2349349655,5
|
2323069589,1
|
||||||
2311838590,5
|
2326520912,1
|
||||||
2348894245,5
|
2326655246,1
|
||||||
2314659369,5
|
2326903290,1
|
||||||
2316150629,5
|
2334430421,1
|
||||||
2345982379,5
|
225958786,1
|
||||||
2326520912,5
|
2337952436,1
|
||||||
2337952436,5
|
2341774429,1
|
||||||
203314437,5
|
23421122,1
|
||||||
2334430421,5
|
2344471631,1
|
||||||
193814549,5
|
2345982379,1
|
||||||
157087137,5
|
2347561020,1
|
||||||
1160497810,5
|
2348894245,1
|
||||||
1171244159,5
|
2348987001,1
|
||||||
3010580773,5
|
2310406050,1
|
||||||
29954548,5
|
205960791,1
|
||||||
2989649772,5
|
3222821993,1
|
||||||
2978926070,5
|
1524794108,1
|
||||||
1208566436,5
|
1160497810,1
|
||||||
178452970,5
|
1171244159,1
|
||||||
1476953321,5
|
1208566436,1
|
||||||
1444449910,5
|
1247902451,1
|
||||||
280281699,5
|
1253552935,1
|
||||||
16715045,5
|
13854344,1
|
||||||
26895145,5
|
1444449910,1
|
||||||
286335813,5
|
1476953321,1
|
||||||
28667694,5
|
157087137,1
|
||||||
742704658,4
|
203314437,1
|
||||||
2326903290,4
|
1605495,1
|
||||||
2326655246,4
|
1651310523,1
|
||||||
1698501971,4
|
16715045,1
|
||||||
2323069589,4
|
1698501971,1
|
||||||
1605495,4
|
178452970,1
|
||||||
696450846,4
|
189427260,1
|
||||||
1247902451,4
|
193814549,1
|
||||||
1253552935,4
|
197362120,1
|
||||||
664591135,4
|
2349349655,1
|
||||||
863973253,4
|
2349588257,1
|
||||||
1651310523,4
|
2349742676,1
|
||||||
8114841,4
|
3145389278,1
|
||||||
3135349256,4
|
2978926070,1
|
||||||
3145389278,4
|
2989649772,1
|
||||||
2348987001,4
|
29954548,1
|
||||||
3420061649,4
|
3010580773,1
|
||||||
3031766093,4
|
3011933107,1
|
||||||
3196033145,4
|
3031766093,1
|
||||||
265133300,4
|
3118140206,1
|
||||||
2350544061,4
|
3135349256,1
|
||||||
3378606529,4
|
3147958370,1
|
||||||
3011933107,4
|
2349746655,1
|
||||||
493002466,4
|
10437056,1
|
||||||
290636928,4
|
3151377261,1
|
||||||
518871190,4
|
31732840,1
|
||||||
2347561020,4
|
3195293647,1
|
||||||
3222664794,4
|
3196033145,1
|
||||||
2344471631,4
|
3203980088,1
|
||||||
3220049148,4
|
3220049148,1
|
||||||
28665295,3
|
3222664794,1
|
||||||
78576577,3
|
2962064709,1
|
||||||
2341774429,3
|
29452962,1
|
||||||
808524154,3
|
2944593082,1
|
||||||
2944593082,3
|
290636928,1
|
||||||
1524794108,3
|
2350443114,1
|
||||||
29452962,3
|
2350544061,1
|
||||||
3222821993,3
|
2351592628,1
|
||||||
13854344,3
|
2352421906,1
|
||||||
778745779,3
|
2353389310,1
|
||||||
340603317,3
|
2353549582,1
|
||||||
762501019,3
|
2382390052,1
|
||||||
27042865,3
|
2448521375,1
|
||||||
5979030,3
|
247297633,1
|
||||||
189427260,3
|
25685135,1
|
||||||
3429928077,3
|
26487185,1
|
||||||
2382390052,3
|
265133300,1
|
||||||
395739442,3
|
26895145,1
|
||||||
2349746655,3
|
27042865,1
|
||||||
466148111,3
|
280281699,1
|
||||||
643954924,3
|
286335813,1
|
||||||
618469306,3
|
28667694,1
|
||||||
23421122,3
|
9746245,1
|
||||||
2962064709,3
|
|
||||||
308365582,2
|
|
||||||
1717102128,1
|
|
||||||
2959520478,1
|
|
||||||
3449575456,1
|
|
||||||
2346894985,1
|
|
||||||
|
|
|
||||||
|
|
|
@ -1,266 +1,259 @@
|
||||||
id_firm,id_product,count
|
id_firm,id_product,count
|
||||||
340093034,95,616
|
395736790,95,136
|
||||||
395736790,95,607
|
340093034,95,133
|
||||||
29223617,95,564
|
29223617,95,119
|
||||||
303926772,99,494
|
532328014,99,100
|
||||||
532328014,99,488
|
303926772,99,99
|
||||||
331545755,90,339
|
2326722141,90,72
|
||||||
2337727838,90,333
|
331545755,90,71
|
||||||
2326722141,90,332
|
2337727838,90,70
|
||||||
3191869223,91,272
|
3191869223,91,58
|
||||||
728969035,93,240
|
591350440,91,50
|
||||||
2327605629,94,237
|
2327605629,94,47
|
||||||
591350440,91,232
|
2336923756,91,46
|
||||||
517675473,92,226
|
517675473,92,46
|
||||||
2336923756,91,223
|
70634828,55,42
|
||||||
2349705416,94,196
|
728969035,93,41
|
||||||
3111603340,53,193
|
2349705416,94,41
|
||||||
3111603340,55,192
|
214851100,55,40
|
||||||
214851100,54,189
|
70634828,54,40
|
||||||
214851100,55,188
|
214851100,52,40
|
||||||
214851100,52,188
|
16210433,92,39
|
||||||
16116663,92,187
|
214851100,54,38
|
||||||
214851100,53,187
|
3111603340,55,38
|
||||||
214851100,50,187
|
214851100,53,38
|
||||||
214851100,51,184
|
3111603340,52,38
|
||||||
3111603340,54,182
|
70634828,52,38
|
||||||
3111603340,52,181
|
3111603340,50,37
|
||||||
70634828,53,179
|
214851100,50,36
|
||||||
3111603340,51,178
|
70634828,50,36
|
||||||
70634828,52,178
|
3111603340,51,35
|
||||||
70634828,54,178
|
70634828,53,35
|
||||||
3111603340,50,178
|
70634828,51,35
|
||||||
70634828,51,177
|
3111603340,54,35
|
||||||
70634828,55,171
|
2349179532,93,34
|
||||||
16210433,92,168
|
16116663,92,33
|
||||||
471121089,93,168
|
214851100,51,33
|
||||||
70634828,50,168
|
3111603340,53,33
|
||||||
2349179532,93,167
|
471121089,93,29
|
||||||
25980377,39,115
|
25980377,43,27
|
||||||
25980377,38,112
|
3111603340,48,26
|
||||||
25980377,43,108
|
25980377,41,24
|
||||||
214851100,49,106
|
3330358736,40,23
|
||||||
25980377,41,105
|
25980377,40,23
|
||||||
214851100,47,104
|
214851100,48,23
|
||||||
3330358736,43,104
|
70634828,49,23
|
||||||
25980377,40,102
|
214851100,44,23
|
||||||
3330358736,38,102
|
25980377,39,22
|
||||||
214851100,46,102
|
25980377,38,22
|
||||||
25980377,42,101
|
25980377,42,22
|
||||||
3111603340,47,100
|
70634828,48,22
|
||||||
214851100,44,98
|
3111603340,46,22
|
||||||
3111603340,45,96
|
214851100,47,21
|
||||||
3330358736,39,93
|
3330358736,43,21
|
||||||
214851100,48,93
|
3111603340,45,21
|
||||||
3330358736,41,92
|
3330358736,39,21
|
||||||
3330358736,40,92
|
70634828,46,21
|
||||||
214851100,45,91
|
3111603340,47,20
|
||||||
70634828,47,90
|
214851100,49,20
|
||||||
3111603340,46,89
|
214851100,46,20
|
||||||
3111603340,49,89
|
3330358736,38,19
|
||||||
70634828,45,88
|
3330358736,41,19
|
||||||
3111603340,44,86
|
70634828,47,18
|
||||||
3111603340,48,85
|
214851100,45,17
|
||||||
3330358736,42,84
|
3111603340,49,17
|
||||||
70634828,46,81
|
3330358736,42,17
|
||||||
70634828,44,80
|
3111603340,44,17
|
||||||
70634828,48,77
|
70634828,44,15
|
||||||
70634828,49,76
|
70634828,45,14
|
||||||
515770253,9,15
|
1452048,9,3
|
||||||
1452048,9,12
|
515770253,9,3
|
||||||
6,10,10
|
80158773,69,2
|
||||||
495782506,19,10
|
8,37,2
|
||||||
420984285,16,10
|
79938367,9,2
|
||||||
37873062,9,10
|
420984285,16,2
|
||||||
33822284,9,10
|
495782506,19,2
|
||||||
8,37,10
|
33822284,9,2
|
||||||
80158773,69,10
|
3392803162,9,2
|
||||||
1,10,10
|
37873062,9,2
|
||||||
16116663,11,10
|
5971532,9,2
|
||||||
3392803162,9,8
|
6,10,2
|
||||||
79938367,9,8
|
1,10,2
|
||||||
5971532,9,8
|
14913649,9,2
|
||||||
14913649,9,6
|
16116663,11,2
|
||||||
950849442,9,5
|
2350443114,74,1
|
||||||
16116663,10,5
|
5979030,9,1
|
||||||
382080545,9,5
|
562681526,25,1
|
||||||
385766513,24,5
|
578803019,10,1
|
||||||
38852110,10,5
|
5849940,26,1
|
||||||
410030851,27,5
|
5849940,36,1
|
||||||
169978927,66,5
|
16116663,9,1
|
||||||
441623911,79,5
|
59234665,65,1
|
||||||
4607820,9,5
|
596368303,12,1
|
||||||
16715045,10,5
|
598808584,15,1
|
||||||
507827038,10,5
|
543470507,8,1
|
||||||
9620005,9,5
|
16116663,10,1
|
||||||
543470507,8,5
|
618469306,9,1
|
||||||
551856519,33,5
|
6333996,66,1
|
||||||
562681526,25,5
|
640700057,9,1
|
||||||
578803019,10,5
|
643954924,9,1
|
||||||
367669349,31,5
|
644252759,61,1
|
||||||
35404067,9,5
|
648145286,35,1
|
||||||
3462551351,13,5
|
664591135,9,1
|
||||||
214851100,7,5
|
551856519,33,1
|
||||||
3226664625,28,5
|
1651310523,9,1
|
||||||
3268669333,67,5
|
675729777,10,1
|
||||||
3312358902,59,5
|
518871190,9,1
|
||||||
3312358902,79,5
|
35404067,9,1
|
||||||
2310406050,60,5
|
367669349,31,1
|
||||||
225958786,11,5
|
193814549,33,1
|
||||||
205960791,63,5
|
382080545,9,1
|
||||||
178452970,25,5
|
385766513,24,1
|
||||||
203314437,22,5
|
38852110,10,1
|
||||||
197362120,15,5
|
189427260,9,1
|
||||||
193814549,33,5
|
395739442,9,1
|
||||||
3358892171,64,5
|
410030851,27,1
|
||||||
3362063909,10,5
|
178452970,25,1
|
||||||
2349588257,10,5
|
441623911,79,1
|
||||||
5849940,26,5
|
4607820,9,1
|
||||||
59234665,65,5
|
466148111,9,1
|
||||||
907433543,10,5
|
169978927,9,1
|
||||||
78979697,74,5
|
493002466,9,1
|
||||||
733657390,10,5
|
169978927,66,1
|
||||||
737770776,34,5
|
507827038,10,1
|
||||||
756272716,32,5
|
1698501971,9,1
|
||||||
758879940,65,5
|
16715045,10,1
|
||||||
771821595,31,5
|
668539285,17,1
|
||||||
78979697,61,5
|
676597455,68,1
|
||||||
961017,23,5
|
2350544061,9,1
|
||||||
70634828,7,5
|
808524154,9,1
|
||||||
1171244159,32,5
|
778745779,9,1
|
||||||
1160497810,12,5
|
78576577,9,1
|
||||||
805940123,72,5
|
78979697,61,1
|
||||||
862404568,11,5
|
78979697,74,1
|
||||||
872394725,70,5
|
11807506,36,1
|
||||||
9032550,34,5
|
1171244159,32,1
|
||||||
71271700,27,5
|
1160497810,12,1
|
||||||
1208566436,62,5
|
805940123,72,1
|
||||||
596368303,12,5
|
8114841,9,1
|
||||||
668539285,17,5
|
762501019,9,1
|
||||||
3226232,10,5
|
862404568,11,1
|
||||||
598808584,15,5
|
863973253,9,1
|
||||||
6333996,66,5
|
872394725,70,1
|
||||||
640700057,9,5
|
9032550,34,1
|
||||||
644252759,61,5
|
907433543,10,1
|
||||||
648145286,35,5
|
950849442,9,1
|
||||||
675729777,10,5
|
961017,23,1
|
||||||
1444449910,20,5
|
9620005,9,1
|
||||||
676597455,68,5
|
771821595,31,1
|
||||||
688155470,30,5
|
758879940,65,1
|
||||||
157087137,73,5
|
688155470,30,1
|
||||||
1476953321,10,5
|
13854344,9,1
|
||||||
1452048,30,5
|
696450846,9,1
|
||||||
1452048,11,5
|
1605495,9,1
|
||||||
3226664625,13,5
|
157087137,73,1
|
||||||
2349349655,9,5
|
1524794108,9,1
|
||||||
9746245,97,5
|
1476953321,10,1
|
||||||
2424229017,26,5
|
1452048,30,1
|
||||||
2334430421,73,5
|
1452048,11,1
|
||||||
2337952436,24,5
|
1444449910,20,1
|
||||||
2352421906,17,5
|
1253552935,9,1
|
||||||
2353389310,15,5
|
756272716,32,1
|
||||||
2353549582,23,5
|
1247902451,9,1
|
||||||
3010580773,9,5
|
1208566436,62,1
|
||||||
300186799,11,5
|
70634828,7,1
|
||||||
300186799,10,5
|
71271700,27,1
|
||||||
29954548,18,5
|
11807506,9,1
|
||||||
2989649772,71,5
|
733657390,10,1
|
||||||
2978926070,8,5
|
737770776,34,1
|
||||||
2448521375,25,5
|
742704658,9,1
|
||||||
10437056,9,5
|
3462551351,13,1
|
||||||
28667694,10,5
|
3429928077,9,1
|
||||||
247297633,18,5
|
3420061649,9,1
|
||||||
286335813,72,5
|
340603317,9,1
|
||||||
280281699,60,5
|
280281699,60,1
|
||||||
2728939,71,5
|
286335813,72,1
|
||||||
2728939,63,5
|
28667694,10,1
|
||||||
25685135,11,5
|
290636928,9,1
|
||||||
26895145,9,5
|
2348987001,9,1
|
||||||
26487185,62,5
|
2944593082,9,1
|
||||||
2349345463,35,5
|
29452962,9,1
|
||||||
2345982379,67,5
|
2962064709,9,1
|
||||||
2333843479,70,5
|
2978926070,8,1
|
||||||
2348894245,11,5
|
2989649772,71,1
|
||||||
2326520912,10,5
|
29954548,18,1
|
||||||
2350443114,74,5
|
300186799,10,1
|
||||||
3118140206,68,5
|
300186799,11,1
|
||||||
3147958370,12,5
|
3010580773,9,1
|
||||||
314846874,11,5
|
3011933107,9,1
|
||||||
2349742676,33,5
|
3031766093,9,1
|
||||||
3111603340,7,5
|
2348894245,11,1
|
||||||
2349345463,59,5
|
2347561020,9,1
|
||||||
2311838590,97,5
|
2345982379,67,1
|
||||||
3151377261,29,5
|
2728939,71,1
|
||||||
31732840,29,5
|
2728939,63,1
|
||||||
2310534839,64,5
|
27042865,9,1
|
||||||
3195293647,28,5
|
247297633,18,1
|
||||||
2316150629,10,5
|
2351592628,10,1
|
||||||
3203980088,10,5
|
2352421906,17,1
|
||||||
2314659369,20,5
|
2353389310,15,1
|
||||||
2351592628,10,5
|
2353549582,23,1
|
||||||
11807506,9,4
|
2382390052,9,1
|
||||||
664591135,9,4
|
2424229017,26,1
|
||||||
11807506,36,4
|
2424229017,9,1
|
||||||
3145389278,9,4
|
2448521375,25,1
|
||||||
2347561020,9,4
|
25685135,11,1
|
||||||
742704658,9,4
|
26895145,9,1
|
||||||
3196033145,9,4
|
2349746655,10,1
|
||||||
265133300,9,4
|
2349742676,33,1
|
||||||
696450846,9,4
|
2349588257,10,1
|
||||||
3220049148,9,4
|
2349349655,9,1
|
||||||
1247902451,9,4
|
2349345463,59,1
|
||||||
1253552935,9,4
|
2349345463,35,1
|
||||||
2344471631,9,4
|
26487185,62,1
|
||||||
290636928,9,4
|
265133300,9,1
|
||||||
1605495,9,4
|
2344471631,9,1
|
||||||
3031766093,9,4
|
23421122,9,1
|
||||||
3011933107,9,4
|
2341774429,9,1
|
||||||
169978927,9,4
|
2310534839,64,1
|
||||||
863973253,9,4
|
3226664625,13,1
|
||||||
2326903290,9,4
|
3226664625,28,1
|
||||||
2323069589,9,4
|
3268669333,67,1
|
||||||
1698501971,9,4
|
3312358902,59,1
|
||||||
493002466,9,4
|
3312358902,79,1
|
||||||
8114841,9,4
|
2316150629,10,1
|
||||||
1651310523,9,4
|
2314659369,20,1
|
||||||
2350544061,9,4
|
2311838590,97,1
|
||||||
2348987001,9,4
|
2310406050,60,1
|
||||||
518871190,9,4
|
3222821993,9,1
|
||||||
3420061649,9,4
|
225958786,11,1
|
||||||
5849940,36,4
|
214851100,7,1
|
||||||
3378606529,9,4
|
3358892171,64,1
|
||||||
3222664794,9,4
|
3362063909,10,1
|
||||||
2326655246,9,4
|
3378606529,9,1
|
||||||
3135349256,9,4
|
205960791,63,1
|
||||||
778745779,9,3
|
203314437,22,1
|
||||||
762501019,9,3
|
197362120,15,1
|
||||||
2349746655,10,3
|
3226232,10,1
|
||||||
808524154,9,3
|
3222664794,9,1
|
||||||
2382390052,9,3
|
2337952436,24,1
|
||||||
2424229017,9,3
|
3135349256,9,1
|
||||||
78576577,9,3
|
2334430421,73,1
|
||||||
3222821993,9,3
|
2333843479,70,1
|
||||||
16116663,9,3
|
10437056,9,1
|
||||||
2962064709,9,3
|
2326903290,9,1
|
||||||
189427260,9,3
|
2326655246,9,1
|
||||||
340603317,9,3
|
2326520912,10,1
|
||||||
3429928077,9,3
|
3111603340,7,1
|
||||||
395739442,9,3
|
3118140206,68,1
|
||||||
466148111,9,3
|
3145389278,9,1
|
||||||
2341774429,9,3
|
3220049148,9,1
|
||||||
13854344,9,3
|
3147958370,12,1
|
||||||
23421122,9,3
|
314846874,11,1
|
||||||
5979030,9,3
|
3151377261,29,1
|
||||||
618469306,9,3
|
31732840,29,1
|
||||||
29452962,9,3
|
2323069589,9,1
|
||||||
2944593082,9,3
|
3195293647,28,1
|
||||||
643954924,9,3
|
3196033145,9,1
|
||||||
28665295,9,3
|
3203980088,10,1
|
||||||
1524794108,9,3
|
9746245,97,1
|
||||||
27042865,9,3
|
|
||||||
308365582,9,2
|
|
||||||
314846874,9,2
|
|
||||||
2959520478,9,1
|
|
||||||
1717102128,9,1
|
|
||||||
3449575456,9,1
|
|
||||||
2346894985,9,1
|
|
||||||
|
|
|
||||||
|
|
|
@ -1,73 +1,73 @@
|
||||||
id_product,count
|
id_product,count
|
||||||
95,1787
|
95,388
|
||||||
90,1004
|
90,213
|
||||||
99,982
|
99,199
|
||||||
91,727
|
91,154
|
||||||
92,581
|
55,120
|
||||||
93,575
|
92,118
|
||||||
53,559
|
52,116
|
||||||
55,551
|
54,113
|
||||||
54,549
|
50,109
|
||||||
52,547
|
53,106
|
||||||
51,539
|
93,104
|
||||||
50,533
|
51,103
|
||||||
94,433
|
94,88
|
||||||
9,338
|
9,84
|
||||||
47,294
|
48,71
|
||||||
45,275
|
46,63
|
||||||
46,272
|
49,60
|
||||||
49,271
|
47,59
|
||||||
44,264
|
44,55
|
||||||
48,255
|
45,52
|
||||||
38,214
|
43,48
|
||||||
43,212
|
40,46
|
||||||
39,208
|
41,43
|
||||||
41,197
|
39,43
|
||||||
40,194
|
38,41
|
||||||
42,185
|
42,39
|
||||||
10,113
|
10,23
|
||||||
11,45
|
11,9
|
||||||
15,15
|
33,3
|
||||||
12,15
|
7,3
|
||||||
33,15
|
15,3
|
||||||
7,15
|
12,3
|
||||||
25,15
|
25,3
|
||||||
69,10
|
19,2
|
||||||
74,10
|
74,2
|
||||||
68,10
|
68,2
|
||||||
70,10
|
69,2
|
||||||
71,10
|
70,2
|
||||||
72,10
|
71,2
|
||||||
73,10
|
72,2
|
||||||
19,10
|
73,2
|
||||||
79,10
|
8,2
|
||||||
8,10
|
79,2
|
||||||
66,10
|
18,2
|
||||||
18,10
|
97,2
|
||||||
17,10
|
13,2
|
||||||
16,10
|
66,2
|
||||||
13,10
|
16,2
|
||||||
97,10
|
17,2
|
||||||
67,10
|
67,2
|
||||||
32,10
|
27,2
|
||||||
65,10
|
65,2
|
||||||
64,10
|
26,2
|
||||||
34,10
|
29,2
|
||||||
35,10
|
30,2
|
||||||
37,10
|
31,2
|
||||||
31,10
|
32,2
|
||||||
30,10
|
34,2
|
||||||
29,10
|
35,2
|
||||||
28,10
|
36,2
|
||||||
27,10
|
37,2
|
||||||
26,10
|
24,2
|
||||||
24,10
|
64,2
|
||||||
23,10
|
23,2
|
||||||
20,10
|
28,2
|
||||||
59,10
|
59,2
|
||||||
60,10
|
60,2
|
||||||
62,10
|
61,2
|
||||||
63,10
|
62,2
|
||||||
61,10
|
63,2
|
||||||
36,8
|
20,2
|
||||||
22,5
|
22,1
|
||||||
|
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ def fitness(individual, controller_db_obj):
|
||||||
|
|
||||||
do_process(controller_db_obj,ga_id,dct_exp,job)
|
do_process(controller_db_obj,ga_id,dct_exp,job)
|
||||||
# ========== 3️⃣ 获取数据库连接并提取结果 ==========
|
# ========== 3️⃣ 获取数据库连接并提取结果 ==========
|
||||||
simulated_vulnerable_industries = get_vulnerable100_code(connection,ga_id)
|
simulated_vulnerable_industries = get_vulnerable35_code(connection,ga_id)
|
||||||
print(simulated_vulnerable_industries)
|
print(simulated_vulnerable_industries)
|
||||||
# ========== 4️⃣ 获取目标产业集合 ==========
|
# ========== 4️⃣ 获取目标产业集合 ==========
|
||||||
target_vulnerable_industries = get_target_vulnerable_industries()
|
target_vulnerable_industries = get_target_vulnerable_industries()
|
||||||
|
|
@ -154,9 +154,11 @@ def get_target_vulnerable_industries():
|
||||||
{"product": "过程工艺检测", "category": "制程检测", "chain_id": 513740}
|
{"product": "过程工艺检测", "category": "制程检测", "chain_id": 513740}
|
||||||
]
|
]
|
||||||
# 手工转换
|
# 手工转换
|
||||||
industry_list_index = vulnerable100_index = \
|
merged_list = [
|
||||||
['100', '58', '61', '9', '7', '98', '57', '8', '65', '68', '66', '38',
|
'61', '68', '65', '66', '59', '71', '77', '7', '38', '95', '58', '90', '56', '57', '97', '98',
|
||||||
'90', '21', '96', '71', '27', '74', '99', '95', '11', '77', '59', '56', '97']
|
'27', '8', '11', '9', '21', '96', '99', '100', '44', '45', '46', '47', '48', '49', '50', '51',
|
||||||
|
'52', '53', '54', '55'
|
||||||
|
]
|
||||||
# # 提取所有 chain_id,并去重
|
# # 提取所有 chain_id,并去重
|
||||||
# chain_ids = set()
|
# chain_ids = set()
|
||||||
# for item in industry_list:
|
# for item in industry_list:
|
||||||
|
|
@ -167,9 +169,10 @@ def get_target_vulnerable_industries():
|
||||||
# else:
|
# else:
|
||||||
# chain_ids.add(str(item["chain_id"]))
|
# chain_ids.add(str(item["chain_id"]))
|
||||||
|
|
||||||
return industry_list_index
|
return merged_list
|
||||||
|
|
||||||
# 从数据库计算脆弱产业集合
|
# 从数据库计算脆弱产业集合
|
||||||
def get_vulnerable100_code(engine, ga_id):
|
def get_vulnerable35_code(engine, ga_id):
|
||||||
"""
|
"""
|
||||||
计算最脆弱前100产品的 Code 列表(去重),只针对指定 ga_id。
|
计算最脆弱前100产品的 Code 列表(去重),只针对指定 ga_id。
|
||||||
"""
|
"""
|
||||||
|
|
@ -221,7 +224,7 @@ def get_vulnerable100_code(engine, ga_id):
|
||||||
# ===============================
|
# ===============================
|
||||||
# 5️⃣ 选出最脆弱的前100个产品(出现次数最多)
|
# 5️⃣ 选出最脆弱的前100个产品(出现次数最多)
|
||||||
# ===============================
|
# ===============================
|
||||||
vulnerable100_product = count_prod.nlargest(100, "count")["id_product"].tolist()
|
vulnerable100_product = count_prod.nlargest(35, "count")["id_product"].tolist()
|
||||||
print(f"[信息] ga_id={ga_id} 查询完成,共找到 {len(vulnerable100_product)} 个脆弱产品")
|
print(f"[信息] ga_id={ga_id} 查询完成,共找到 {len(vulnerable100_product)} 个脆弱产品")
|
||||||
|
|
||||||
# ===============================
|
# ===============================
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
|
||||||
from GA_Agent_0925.creating import creating
|
from GA_Agent_0925.creating import creating
|
||||||
from GA_Agent_0925.orm import connection
|
from GA_Agent_0925.orm import connection
|
||||||
from controller_db import ControllerDB
|
from controller_db import ControllerDB
|
||||||
from evaluate_func import fitness, get_vulnerable100_code, get_target_vulnerable_industries
|
from evaluate_func import fitness, get_vulnerable35_code, get_target_vulnerable_industries
|
||||||
|
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
@ -28,7 +28,7 @@ def main():
|
||||||
|
|
||||||
# 2️⃣ 初始化 ControllerDB(数据库连接)
|
# 2️⃣ 初始化 ControllerDB(数据库连接)
|
||||||
controller_db_obj = ControllerDB("without_exp", reset_flag=0)
|
controller_db_obj = ControllerDB("without_exp", reset_flag=0)
|
||||||
controller_db_obj.reset_db(force_drop=True)
|
controller_db_obj.reset_db(force_drop=False)
|
||||||
# 准备样本表
|
# 准备样本表
|
||||||
controller_db_obj.prepare_list_sample()
|
controller_db_obj.prepare_list_sample()
|
||||||
# 2️⃣ 初始化工具箱
|
# 2️⃣ 初始化工具箱
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
|
|
@ -0,0 +1,10 @@
|
||||||
|
# read by orm
|
||||||
|
is_local_db: True
|
||||||
|
|
||||||
|
local:
|
||||||
|
user_name: iiabm_user
|
||||||
|
password: iiabm_pwd
|
||||||
|
db_name: iiabmdb_20250925
|
||||||
|
address: 'localhost'
|
||||||
|
port: 3306
|
||||||
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
db_name_prefix: without_exp
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
import pandas as pd
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
from orm import engine
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# 数据库连接
|
||||||
|
# ===============================
|
||||||
|
|
||||||
|
sql_file = "query_top35_products.sql"
|
||||||
|
|
||||||
|
# 指定对比列表
|
||||||
|
specified_list = [
|
||||||
|
'61','68','65','66','59','71','77','7','38','95','58','90','56','57','97','98',
|
||||||
|
'27','8','11','9','21','96','99','100','44','45','46','47','48','49','50','51',
|
||||||
|
'52','53','54','55'
|
||||||
|
]
|
||||||
|
specified_set = set(specified_list)
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# 执行 SQL 查询
|
||||||
|
# ===============================
|
||||||
|
with open(sql_file, "r", encoding="utf-8") as f:
|
||||||
|
str_sql = f.read()
|
||||||
|
|
||||||
|
# 使用 connect() 解决 AttributeError
|
||||||
|
with engine.connect() as conn:
|
||||||
|
df = pd.read_sql(text(str_sql), conn)
|
||||||
|
|
||||||
|
print(f"[信息] 查询完成,获取到 {len(df)} 条记录。")
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# 按 ga_id 分组计算匹配情况
|
||||||
|
# ===============================
|
||||||
|
all_results = []
|
||||||
|
|
||||||
|
for ga_id, group in df.groupby("ga_id"):
|
||||||
|
vulnerable35_product = group['id_product'].astype(str).tolist()
|
||||||
|
vulnerable_set = set(vulnerable35_product)
|
||||||
|
|
||||||
|
matching = vulnerable_set & specified_set
|
||||||
|
extra = vulnerable_set - specified_set
|
||||||
|
missing = specified_set - vulnerable_set
|
||||||
|
|
||||||
|
all_results.append({
|
||||||
|
"ga_id": ga_id,
|
||||||
|
"vulnerable35": ",".join(vulnerable35_product),
|
||||||
|
"matching_count": len(matching),
|
||||||
|
"matching_products": ",".join(matching),
|
||||||
|
"extra_count": len(extra),
|
||||||
|
"extra_products": ",".join(extra),
|
||||||
|
"missing_count": len(missing),
|
||||||
|
"missing_products": ",".join(missing)
|
||||||
|
})
|
||||||
|
|
||||||
|
# ===============================
|
||||||
|
# 输出 CSV
|
||||||
|
# ===============================
|
||||||
|
df_results = pd.DataFrame(all_results)
|
||||||
|
df_results.to_csv("vulnerable35_match_results.csv", index=False, encoding='utf-8-sig')
|
||||||
|
print("[完成] 已生成 vulnerable35_match_results.csv")
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
WITH s_disrupt AS (
|
||||||
|
SELECT s_id, id_firm, id_product, MIN(ts) AS ts, ga_id
|
||||||
|
FROM iiabmdb_20250925.without_exp_result
|
||||||
|
WHERE `status` = 'D'
|
||||||
|
GROUP BY s_id, id_firm, id_product, ga_id
|
||||||
|
),
|
||||||
|
|
||||||
|
s_multiple AS (
|
||||||
|
-- 筛选出现超过1次的 s_id
|
||||||
|
SELECT s_id, ga_id
|
||||||
|
FROM s_disrupt
|
||||||
|
GROUP BY s_id, ga_id
|
||||||
|
HAVING COUNT(*) > 1
|
||||||
|
),
|
||||||
|
|
||||||
|
product_count AS (
|
||||||
|
-- 统计每个 ga_id 下每个产品出现次数
|
||||||
|
SELECT s.ga_id, s.id_product, COUNT(*) AS cnt
|
||||||
|
FROM s_disrupt s
|
||||||
|
JOIN s_multiple m ON s.s_id = m.s_id AND s.ga_id = m.ga_id
|
||||||
|
GROUP BY s.ga_id, s.id_product
|
||||||
|
),
|
||||||
|
|
||||||
|
ranked_products AS (
|
||||||
|
-- 按每个 ga_id 的产品出现次数排序,并取前35
|
||||||
|
SELECT *,
|
||||||
|
ROW_NUMBER() OVER (PARTITION BY ga_id ORDER BY cnt DESC) AS rn
|
||||||
|
FROM product_count
|
||||||
|
)
|
||||||
|
|
||||||
|
SELECT ga_id, id_product, cnt
|
||||||
|
FROM ranked_products
|
||||||
|
WHERE rn <= 35
|
||||||
|
ORDER BY ga_id, rn;
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
ga_id,vulnerable35,matching_count,matching_products,extra_count,extra_products,missing_count,missing_products
|
||||||
|
03269d9f,"95,90,91,92,52,93,55,99,51,50,9,94,54,53,47,44,46,48,49,45,41,42,38,43,39,40,10,11,7,12,25,15,33,73,32",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,91,73,94,41,39,15,10,25,32,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
053c105b,"95,99,90,91,55,50,53,52,92,51,54,93,94,9,48,47,44,46,49,39,38,45,40,43,41,42,10,11,15,33,12,7,25,31,36",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,25,93,31,40,94,41,39,15,10,36,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
07257290,"95,99,90,91,52,53,51,50,92,55,93,54,94,9,49,47,48,39,44,46,45,43,38,40,42,41,10,11,25,7,15,12,33,26,18",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,18,40,26,94,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
12eb85fc,"95,99,90,91,51,52,93,92,50,53,54,55,9,94,47,49,48,46,44,45,38,40,43,39,41,42,10,11,7,25,12,33,15,37,19",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,19,94,41,39,37,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
1809ec77,"95,99,90,91,93,92,53,52,50,94,55,51,54,9,49,44,47,40,46,45,39,48,38,43,41,42,10,11,20,26,66,16,15,64,61",20,"90,61,44,45,95,49,11,99,52,50,47,9,66,46,54,51,48,55,38,53",15,"42,93,40,26,94,41,39,16,15,20,10,91,43,64,92",16,"98,71,57,56,65,7,97,100,8,68,77,58,21,59,96,27"
|
||||||
|
19cae10f,"95,99,90,91,51,50,53,92,52,93,55,54,9,94,47,49,46,48,45,44,38,43,39,40,41,42,10,11,25,12,33,15,7,64,8",20,"90,7,44,45,95,49,11,99,8,52,50,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,41,39,15,64,10,25,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,61,68,77,58,21,59,96,27"
|
||||||
|
1a4227c6,"95,99,90,91,52,92,54,53,51,55,50,93,94,9,47,49,46,48,44,45,43,39,38,41,42,40,10,11,7,25,33,15,12,74,68",20,"90,7,68,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,74,41,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,65,56,97,100,8,61,77,58,21,59,96,27"
|
||||||
|
1f977ec5,"95,99,90,91,52,92,50,55,53,51,93,54,94,9,48,47,46,44,49,45,40,41,38,39,43,42,10,11,12,15,25,33,7,35,64",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,35,40,94,41,39,15,64,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
28481dd9,"95,99,90,91,52,51,55,50,92,53,54,93,94,9,47,49,44,46,48,38,43,45,40,39,41,42,10,11,25,7,33,12,15,32,97",20,"90,7,44,45,95,49,11,99,52,50,97,47,9,46,54,51,48,55,38,53",15,"42,93,40,91,94,41,39,15,10,25,32,43,12,33,92",16,"98,71,57,66,56,65,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
2ef7bd37,"95,99,90,91,53,52,50,92,54,51,55,93,94,9,49,47,46,44,48,39,45,43,41,40,38,42,10,11,7,25,33,15,12,60,30",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,60,93,40,94,30,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
360d68d3,"95,99,90,91,9,53,92,93,50,52,51,55,54,94,47,44,46,49,48,43,39,45,38,40,41,42,10,11,15,33,7,12,27,69,72",20,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,53,38,27",15,"42,93,40,94,41,69,39,72,15,10,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96"
|
||||||
|
400b809d,"95,99,90,91,51,52,50,53,92,55,54,93,9,47,94,49,44,46,39,38,48,43,40,45,41,42,10,11,33,7,25,12,15,24,19",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,19,94,41,43,39,15,10,25,91,24,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
40408929,"95,99,90,91,53,51,52,93,92,50,55,54,94,9,49,47,46,48,44,45,39,38,43,40,41,42,10,11,25,12,33,7,15,70,29",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,70,94,41,39,29,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
4c00c80f,"95,99,90,91,52,51,50,92,54,53,55,93,9,94,46,44,47,49,48,45,43,38,39,40,41,42,10,11,15,7,12,33,25,28,59",20,"90,7,44,45,95,49,11,99,52,50,59,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,28,41,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,96,27"
|
||||||
|
54476776,"95,90,91,93,55,99,92,52,53,51,50,94,9,54,47,49,44,46,48,45,42,41,38,39,43,40,10,11,12,7,15,33,25,74,16",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,74,41,39,16,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
5848e257,"95,90,99,91,50,53,92,55,52,54,93,51,94,9,49,44,46,47,48,40,43,45,39,38,41,42,10,11,15,33,7,12,25,35,74",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,35,40,94,74,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
60a50e3a,"95,99,90,91,52,53,51,55,50,54,92,93,9,94,44,46,49,47,48,43,38,40,39,45,41,42,10,11,12,7,33,25,15,79,23",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,41,39,15,10,25,91,43,79,12,23,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
64f2207b,"95,90,99,91,50,52,53,93,55,92,51,54,9,94,47,49,46,48,44,39,43,38,41,45,40,42,10,11,7,12,25,33,15,60,35",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,60,35,40,93,94,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
69c68390,"95,99,90,91,92,50,51,52,55,53,93,54,94,9,44,49,46,47,48,38,39,43,41,45,40,42,10,11,25,12,33,7,15,74,27",20,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,53,38,27",15,"42,93,40,94,74,41,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96"
|
||||||
|
6a5f8b48,"95,90,99,91,52,54,55,53,92,51,50,93,9,94,47,46,49,48,44,43,39,45,38,40,41,42,10,11,25,33,15,7,12,29,68",20,"90,7,68,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,41,39,29,15,10,25,91,43,12,33,92",16,"98,71,57,66,65,56,97,100,8,61,77,58,21,59,96,27"
|
||||||
|
6a8ce407,"95,90,99,91,52,51,55,53,92,93,50,54,9,94,47,48,49,46,44,38,45,41,39,43,42,40,10,11,15,25,7,12,33,63,23",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,25,93,40,94,41,39,15,10,63,91,43,12,23,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
6d45f1e1,"95,99,90,91,50,53,52,51,92,55,93,54,9,94,49,46,47,44,48,39,40,45,38,43,41,42,10,11,12,25,7,15,33,13,68",20,"90,7,68,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,41,39,15,10,25,91,43,13,12,33,92",16,"98,71,57,66,65,56,97,100,8,61,77,58,21,59,96,27"
|
||||||
|
6f1514cd,"95,99,90,91,53,55,52,92,50,93,51,54,9,94,49,47,48,46,43,39,44,45,41,38,40,42,10,11,15,25,33,12,7,30,27",20,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,53,38,27",15,"42,93,40,94,30,41,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96"
|
||||||
|
79566791,"95,99,90,91,50,52,51,55,93,53,92,54,9,94,49,47,48,44,46,40,45,43,39,38,41,42,10,11,12,25,33,7,15,63,59",20,"90,7,44,45,95,49,11,99,52,50,59,47,9,46,54,51,48,55,38,53",15,"42,25,93,40,94,41,39,15,10,63,91,43,12,33,92",16,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,96,27"
|
||||||
|
7bd74425,"95,99,90,91,51,52,93,50,53,92,55,54,9,94,47,44,49,48,46,40,45,43,38,39,41,42,10,11,33,25,15,12,7,26,23",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,26,94,41,39,15,10,25,91,43,12,23,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
80c8326a,"95,99,90,91,52,50,92,53,93,55,54,51,9,94,49,46,47,44,48,45,40,39,43,38,41,42,10,11,7,25,15,33,12,73,31",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,31,40,73,94,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
8ce09dcc,"95,90,99,91,55,92,52,54,50,53,93,51,94,9,48,46,49,47,44,45,43,40,41,39,38,42,10,11,7,25,15,12,33,69,32",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,91,94,41,69,39,15,10,25,32,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
8e527645,"95,99,90,91,93,55,92,53,50,52,51,54,94,9,47,46,49,48,44,45,43,39,40,38,42,41,10,11,25,12,15,33,7,62,37",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,62,93,40,94,41,39,37,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
93f9d03b,"95,99,90,91,51,50,93,92,53,54,55,52,9,94,47,46,48,44,49,38,39,43,45,41,40,42,10,11,33,12,7,25,15,64,35",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,35,40,94,41,39,15,64,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
9965ff7d,"95,90,91,99,55,93,92,52,53,51,94,54,50,9,49,48,47,46,44,45,41,43,39,38,42,40,10,11,15,12,33,25,7,28,73",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,73,94,28,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
b5b6882d,"95,99,90,91,53,52,54,50,55,93,92,51,94,9,49,47,46,44,48,39,43,45,40,38,41,42,10,11,25,33,15,12,7,18,74",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,18,40,94,74,41,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
bd999a28,"95,99,90,91,53,52,55,51,50,54,92,93,9,94,49,47,39,46,48,44,45,38,40,43,42,41,10,11,33,25,12,15,7,65,29",20,"90,7,44,45,95,49,11,65,99,52,50,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,41,39,29,15,10,25,91,43,12,33,92",16,"98,71,57,66,56,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
be8d64fc,"95,99,90,91,52,51,93,54,50,55,92,53,94,9,47,49,46,44,48,45,38,43,39,41,40,42,10,11,25,7,33,12,15,13,30",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,30,41,39,15,10,25,91,43,13,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
c40fd813,"95,99,90,91,50,53,51,52,93,55,92,54,9,94,49,47,44,39,46,45,48,38,40,41,43,42,10,11,15,33,25,12,7,37,28",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,28,41,39,37,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
c5f9a379,"95,99,90,91,51,53,50,52,92,55,54,93,9,94,47,49,45,48,44,46,43,39,40,38,41,42,10,11,7,15,12,25,33,66,65",21,"90,7,44,45,95,49,11,65,99,52,50,47,9,66,46,54,51,48,55,38,53",14,"42,93,40,94,41,39,15,10,25,91,43,12,33,92",15,"98,71,57,56,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
cd8df852,"95,99,90,91,53,52,50,55,51,92,93,54,94,9,49,47,46,48,44,45,39,40,41,43,38,42,10,11,12,33,7,15,25,35,69",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,35,40,94,41,69,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
cfec2d46,"95,99,90,91,53,52,50,93,51,55,92,54,9,94,49,45,47,44,48,46,40,39,43,38,42,41,10,11,33,7,12,15,25,37,18",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,18,40,94,41,39,37,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
d0d03833,"95,99,90,91,51,50,53,52,92,55,54,93,94,9,47,49,48,44,46,39,38,45,43,40,41,42,10,11,7,15,12,25,33,62,68",20,"90,7,68,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",15,"42,62,93,40,94,41,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,65,56,97,100,8,61,77,58,21,59,96,27"
|
||||||
|
d8521d12,"95,99,90,91,51,92,52,53,93,50,55,54,9,94,49,44,47,46,48,39,45,40,38,43,41,42,10,11,33,7,15,12,25,16,72",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,41,39,72,16,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
d8836638,"95,99,90,91,50,54,53,51,52,55,93,92,9,94,47,49,46,48,44,38,39,43,40,41,45,42,10,11,15,33,7,12,25,97,69",20,"90,7,44,45,95,49,11,99,52,50,97,47,9,46,54,51,48,55,38,53",15,"42,93,40,94,41,69,39,15,10,25,91,43,12,33,92",16,"98,71,57,66,56,65,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
daf0e9ef,"95,99,90,91,52,53,55,50,92,51,54,93,9,94,49,48,47,39,46,45,44,40,38,41,43,42,10,11,15,33,25,7,12,69,71",20,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,71,55,38,53",15,"42,93,40,94,41,69,39,15,10,25,91,43,12,33,92",16,"98,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
dbfb776b,"95,90,91,92,93,55,52,99,53,9,50,94,51,54,47,49,48,46,44,45,41,42,40,38,43,39,10,11,15,25,12,33,7,34,69",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,34,41,69,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
e087b751,"95,99,90,91,93,53,50,51,54,55,52,92,9,94,49,47,48,44,46,45,39,43,38,40,41,42,10,11,25,33,12,7,15,31,23",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,31,40,94,41,39,15,10,25,91,43,12,23,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
e2a464f9,"95,99,90,91,51,53,50,52,93,55,92,54,9,94,49,47,48,44,45,39,46,38,40,41,43,42,10,11,15,7,25,12,33,29,69",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,41,69,29,39,15,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
e73abaeb,"95,99,90,91,54,52,55,51,50,93,53,92,94,9,47,46,49,48,43,38,44,45,40,39,41,42,10,11,25,12,15,33,7,69,64",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,40,94,41,69,39,15,64,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
f4b59d31,"95,99,90,91,50,51,52,55,53,93,92,54,94,9,47,49,46,44,48,40,45,38,43,39,41,42,10,11,25,15,33,12,7,20,31",19,"90,7,44,45,95,49,11,99,52,50,47,9,46,54,51,48,55,38,53",16,"42,93,31,40,94,41,39,15,20,10,25,91,43,12,33,92",17,"98,71,57,66,56,65,97,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
f54db476,"95,99,90,91,52,92,93,51,55,53,50,54,9,94,47,44,49,48,46,45,43,39,38,40,41,42,10,11,12,15,33,7,25,36,97",20,"90,7,44,45,95,49,11,99,52,50,97,47,9,46,54,51,48,55,38,53",15,"42,25,93,40,94,41,39,15,10,36,91,43,12,33,92",16,"98,71,57,66,56,65,100,8,61,68,77,58,21,59,96,27"
|
||||||
|
f9ef00a1,"95,99,90,91,52,51,92,55,50,53,93,54,94,9,49,47,48,44,46,45,39,41,38,40,43,42,10,11,15,7,12,33,25,65,59",21,"90,7,44,45,95,49,11,65,99,52,50,59,47,9,46,54,51,48,55,38,53",14,"42,93,40,94,41,39,15,10,25,91,43,12,33,92",15,"98,71,57,66,56,97,100,8,61,68,77,58,21,96,27"
|
||||||
|
|
|
@ -41,7 +41,7 @@ from orm import connection
|
||||||
|
|
||||||
|
|
||||||
# 读取 SQL
|
# 读取 SQL
|
||||||
ga_id="c943f2c6"
|
ga_id="c40fd813"
|
||||||
with open("SQL_analysis_risk_ga.sql", "r", encoding="utf-8") as f:
|
with open("SQL_analysis_risk_ga.sql", "r", encoding="utf-8") as f:
|
||||||
str_sql = text(f.read())
|
str_sql = text(f.read())
|
||||||
print(str_sql[:300])
|
print(str_sql[:300])
|
||||||
|
|
|
||||||
Binary file not shown.
6
firm.py
6
firm.py
|
|
@ -1,5 +1,6 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
from mesa import Agent
|
from mesa import Agent
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -81,7 +82,7 @@ class FirmAgent(Agent):
|
||||||
for product in a_lst_product:
|
for product in a_lst_product:
|
||||||
assert self.str_cap_limit_prob_type in ['uniform', 'normal'], \
|
assert self.str_cap_limit_prob_type in ['uniform', 'normal'], \
|
||||||
"cap_limit_prob_type must be either 'uniform' or 'normal'"
|
"cap_limit_prob_type must be either 'uniform' or 'normal'"
|
||||||
extra_cap_mean = self.size_stat[0][0] / self.flt_cap_limit_level
|
extra_cap_mean = self.size_stat[0][0] / self.flt_cap_limit_level if self.flt_cap_limit_level != 0 else 0
|
||||||
if self.str_cap_limit_prob_type == 'uniform':
|
if self.str_cap_limit_prob_type == 'uniform':
|
||||||
extra_cap = self.model.random.uniform(extra_cap_mean - 2, extra_cap_mean + 2)
|
extra_cap = self.model.random.uniform(extra_cap_mean - 2, extra_cap_mean + 2)
|
||||||
extra_cap = 0 if round(extra_cap) < 0 else round(extra_cap)
|
extra_cap = 0 if round(extra_cap) < 0 else round(extra_cap)
|
||||||
|
|
@ -256,6 +257,9 @@ class FirmAgent(Agent):
|
||||||
prod_accept = 1.0
|
prod_accept = 1.0
|
||||||
else:
|
else:
|
||||||
prod_accept = self.flt_diff_new_conn
|
prod_accept = self.flt_diff_new_conn
|
||||||
|
# 安全处理,防止异常概率
|
||||||
|
prod_accept = np.nan_to_num(prod_accept, nan=0.0)
|
||||||
|
prod_accept = max(0.0, min(1.0, prod_accept))
|
||||||
if self.model.nprandom.choice([True, False], p=[prod_accept, 1 - prod_accept]):
|
if self.model.nprandom.choice([True, False], p=[prod_accept, 1 - prod_accept]):
|
||||||
self.firm_network.add_edge(self.unique_id, down_firm.unique_id, Product=product.unique_id)
|
self.firm_network.add_edge(self.unique_id, down_firm.unique_id, Product=product.unique_id)
|
||||||
self.dct_prod_capacity[product] -= 1
|
self.dct_prod_capacity[product] -= 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue