-
Notifications
You must be signed in to change notification settings - Fork 41
/
config.py
132 lines (125 loc) · 6.09 KB
/
config.py
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from utils import *
# === Address points ===
# 3个配送点 8个卸货点
DY_position = [[15, 14], [26, 28], [10, 24]]
DP_position = [[21, 13], [11, 22], [30, 28], [21, 31],
[13, 24], [32, 22], [24, 30], [19, 21]]
# === other config ===
Max_Route_Len = 20 # 最长路径长度
Max_Order_Num = 20 # 最大订单数目
Decision_Time_Interval = 10 # 决策时间间隔
Max_Drone_Carry = 10 # 无人机最多承载商品数目
Item_Priority = [30, 90, 180]
Drone_Speed = 1
Time_to_Work = 24
# === all data ===
distance_dp2dp = dis_matrix(DP_position, DP_position)
distance_dy2dp = dis_matrix(DY_position, DP_position)
distance_dp2dp = [[0.0, 100, 100, 100, 100, 100, 100, 8.25],
[100, 0.0, 100, 100, 2.83, 100, 100, 8.06],
[100, 100, 0.0, 9.49, 100, 6.32, 6.32, 100],
[100, 100, 9.49, 0.0, 100, 100, 3.16, 100],
[100, 2.83, 100, 100, 0.0, 100, 100, 6.71],
[100, 100, 6.32, 100, 100, 0.0, 100, 100],
[100, 100, 6.32, 3.16, 100, 100, 0.0, 100],
[8.25, 8.06, 100, 100, 6.71, 100, 100, 0.0]]
distance_dy2dp = [[6.08, 8.94, 100, 100, 100, 100, 100, 8.06],
[100, 100, 4.0, 5.83, 100, 8.49, 2.83, 9.9],
[100, 2.24, 100, 100, 3.0, 100, 100, 9.49]]
# draw_lines(DY_position, DP_position, distance_dp2dp, distance_dy2dp)
graph = {
'dy1': {'dp1': 6.08, 'dp2': 8.94, 'dp8': 8.06},
'dy2': {'dp3': 4, 'dp4': 5.83, 'dp6': 8.49, 'dp7': 2.83, 'dp8': 9.9},
'dy3': {'dp2': 2.24, 'dp5': 3, 'dp8': 9.49},
'dp1': {'dy1': 6.08, 'dp8': 8.25},
'dp2': {'dy1': 8.94, 'dy3': 2.24, 'dp5': 2.83, 'dp8': 8.06},
'dp3': {'dy2': 4, 'dp4': 9.49, 'dp6': 6.32, 'dp7': 6.32},
'dp4': {'dy2': 5.83, 'dp3': 9.49, 'dp7': 3.16},
'dp5': {'dy3': 3, 'dp2': 2.83, 'dp8': 6.71},
'dp6': {'dy2': 8.49, 'dp3': 6.32},
'dp7': {'dy2': 2.83, 'dp3': 6.32, 'dp4': 3.16},
'dp8': {'dy1': 8.06, 'dy2': 9.9, 'dy3': 9.49, 'dp1': 8.25, 'dp2': 8.06, 'dp5': 6.71}
}
dy_list = ['dy1', 'dy2', 'dy3']
dp_list = ['dp1', 'dp2', 'dp3', 'dp4', 'dp5', 'dp6', 'dp7', 'dp8']
# routes_sat, routes_len = find_cycles_sat(graph)
routes_sat = [['dy1', 'dp1', 'dy1'],
['dy1', 'dp2', 'dy1'],
['dy1', 'dp8', 'dy1'],
['dy2', 'dp3', 'dy2'],
['dy2', 'dp3', 'dp4', 'dy2'],
['dy2', 'dp3', 'dp4', 'dp7', 'dy2'],
['dy2', 'dp3', 'dp6', 'dy2'],
['dy2', 'dp3', 'dp7', 'dy2'],
['dy2', 'dp3', 'dp7', 'dp4', 'dy2'],
['dy2', 'dp4', 'dy2'],
['dy2', 'dp4', 'dp7', 'dy2'],
['dy2', 'dp6', 'dy2'],
['dy2', 'dp7', 'dy2'],
['dy2', 'dp8', 'dy2'],
['dy3', 'dp2', 'dy3'],
['dy3', 'dp2', 'dp5', 'dy3'],
['dy3', 'dp2', 'dp8', 'dy3'],
['dy3', 'dp5', 'dy3'],
['dy3', 'dp5', 'dp8', 'dy3'],
['dy3', 'dp8', 'dy3']]
routes_len = [[0.0, 6.08, 12.16],
[0.0, 8.94, 17.88],
[0.0, 8.06, 16.12],
[0.0, 4.0, 8.0],
[0.0, 4.0, 13.49, 19.32],
[0.0, 4.0, 13.49, 16.65, 19.48],
[0.0, 4.0, 10.32, 18.81],
[0.0, 4.0, 10.32, 13.15],
[0.0, 4.0, 10.32, 13.48, 19.31],
[0.0, 5.83, 11.66],
[0.0, 5.83, 8.99, 11.82],
[0.0, 8.49, 16.98],
[0.0, 2.83, 5.66],
[0.0, 9.9, 19.8],
[0.0, 2.24, 4.48],
[0.0, 2.24, 5.07, 8.07],
[0.0, 2.24, 10.3, 19.79],
[0.0, 3.0, 6.0],
[0.0, 3.0, 9.71, 19.2],
[0.0, 9.49, 18.98]]
dy2dp_direct = []
for i in range(len(routes_sat)):
if len(routes_sat[i]) == 3:
dy2dp_direct.append([routes_sat[i][1], routes_len[i][-1], routes_sat[i]])
print(dy2dp_direct)
dy2dp_direct = [['dp1', 12.16, ['dy1', 'dp1', 'dy1']],
['dp2', 4.48, ['dy3', 'dp2', 'dy3']],
['dp3', 8.0, ['dy2', 'dp3', 'dy2']],
['dp4', 11.66, ['dy2', 'dp4', 'dy2']],
['dp5', 6.0, ['dy3', 'dp5', 'dy3']],
['dp6', 16.98, ['dy2', 'dp6', 'dy2']],
['dp7', 5.66, ['dy2', 'dp7', 'dy2']],
['dp8', 16.12, ['dy1', 'dp8', 'dy1']]]
dps = []
for dp in dp_list:
for rt_i in range(len(routes_sat)):
if len(routes_sat[rt_i]) != 3:
if dp in routes_sat[rt_i]:
dps.append([dp, routes_sat[rt_i], routes_len[rt_i]])
print(sorted(dps))
dps = [['dp2', ['dy3', 'dp2', 'dp5', 'dy3'], [0.0, 2.24, 5.07, 8.07]],
['dp2', ['dy3', 'dp2', 'dp8', 'dy3'], [0.0, 2.24, 10.3, 19.79]],
['dp3', ['dy2', 'dp3', 'dp7', 'dy2'], [0.0, 4.0, 10.32, 13.15]],
['dp3', ['dy2', 'dp3', 'dp6', 'dy2'], [0.0, 4.0, 10.32, 18.81]],
['dp3', ['dy2', 'dp3', 'dp7', 'dp4', 'dy2'], [0.0, 4.0, 10.32, 13.48, 19.31]],
['dp3', ['dy2', 'dp3', 'dp4', 'dy2'], [0.0, 4.0, 13.49, 19.32]],
['dp3', ['dy2', 'dp3', 'dp4', 'dp7', 'dy2'], [0.0, 4.0, 13.49, 16.65, 19.48]],
['dp4', ['dy2', 'dp4', 'dp7', 'dy2'], [0.0, 5.83, 8.99, 11.82]],
['dp4', ['dy2', 'dp3', 'dp7', 'dp4', 'dy2'], [0.0, 4.0, 10.32, 13.48, 19.31]],
['dp4', ['dy2', 'dp3', 'dp4', 'dy2'], [0.0, 4.0, 13.49, 19.32]],
['dp4', ['dy2', 'dp3', 'dp4', 'dp7', 'dy2'], [0.0, 4.0, 13.49, 16.65, 19.48]],
['dp5', ['dy3', 'dp2', 'dp5', 'dy3'], [0.0, 2.24, 5.07, 8.07]],
['dp5', ['dy3', 'dp5', 'dp8', 'dy3'], [0.0, 3.0, 9.71, 19.2]],
['dp6', ['dy2', 'dp3', 'dp6', 'dy2'], [0.0, 4.0, 10.32, 18.81]],
['dp7', ['dy2', 'dp4', 'dp7', 'dy2'], [0.0, 5.83, 8.99, 11.82]],
['dp7', ['dy2', 'dp3', 'dp7', 'dy2'], [0.0, 4.0, 10.32, 13.15]],
['dp7', ['dy2', 'dp3', 'dp7', 'dp4', 'dy2'], [0.0, 4.0, 10.32, 13.48, 19.31]],
['dp7', ['dy2', 'dp3', 'dp4', 'dp7', 'dy2'], [0.0, 4.0, 13.49, 16.65, 19.48]],
['dp8', ['dy3', 'dp5', 'dp8', 'dy3'], [0.0, 3.0, 9.71, 19.2]],
['dp8', ['dy3', 'dp2', 'dp8', 'dy3'], [0.0, 2.24, 10.3, 19.79]]]