Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张晓彤
integrated-scheduling
Commits
b68d9546
Commit
b68d9546
authored
Nov 01, 2021
by
Allvey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车流规划修复
parent
711d6723
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
115 deletions
+146
-115
dump.py
equipment/dump.py
+2
-1
para_config.py
para_config.py
+9
-1
path_plannner.py
path_plan/path_plannner.py
+1
-1
realtime_dispatch.py
realtime_dispatch.py
+132
-111
traffic_flow_info.py
traffic_flow/traffic_flow_info.py
+1
-1
traffic_flow_planner.py
traffic_flow/traffic_flow_planner.py
+1
-0
No files found.
equipment/dump.py
View file @
b68d9546
...
...
@@ -178,4 +178,4 @@ class DumpInfo(WalkManage):
self
.
update_dump_priority
()
# 卸载目标产量
#
self.dump_target_mass = np.full(self.dynamic_dump_num, dump_target_mass)
self
.
dump_target_mass
=
np
.
full
(
self
.
dynamic_dump_num
,
dump_target_mass
)
\ No newline at end of file
para_config.py
View file @
b68d9546
...
...
@@ -335,6 +335,10 @@ class WalkManage(DeviceMap):
# 计算设备路网距离及行走时间
try
:
logger
.
info
(
'dynamic_dump_num'
)
logger
.
info
(
dynamic_dump_num
)
logger
.
info
(
'dynamic_excavator_num'
)
logger
.
info
(
dynamic_excavator_num
)
for
i
in
range
(
dynamic_dump_num
):
for
j
in
range
(
dynamic_excavator_num
):
self
.
distance_to_excavator
[
i
][
j
]
=
self
.
distance_to_load_area
[
...
...
@@ -350,10 +354,14 @@ class WalkManage(DeviceMap):
self
.
dump_index_to_unload_area_index_dict
[
i
]
][
self
.
excavator_index_to_load_area_index_dict
[
j
]]
except
Exception
as
es
:
logger
.
error
(
"设备路网信息异常
异常
"
)
logger
.
error
(
"设备路网信息异常"
)
logger
.
error
(
es
)
try
:
logger
.
info
(
'load_area_uuid_to_index_dict'
)
logger
.
info
(
load_area_uuid_to_index_dict
)
logger
.
info
(
'park_uuid_to_index_dict'
)
logger
.
info
(
park_uuid_to_index_dict
)
for
item
in
session_postgre
.
query
(
WalkTimePark
)
.
all
():
load_area
=
str
(
item
.
load_area_id
)
park_area
=
str
(
item
.
park_area_id
)
...
...
path_plan/path_plannner.py
View file @
b68d9546
...
...
@@ -57,7 +57,7 @@ class PathPlanner(WalkManage):
# 修正因子
weight
=
60
# 阻塞成本权重
alpha
=
0
alpha
=
1
# 距离成本权重
beta
=
1
...
...
realtime_dispatch.py
View file @
b68d9546
...
...
@@ -9,27 +9,22 @@
# 实时调度模块
from
traffic_flow.traffic_flow_info
import
*
from
traffic_flow.traffic_flow_planner
import
*
from
path_plan.path_plannner
import
*
from
para_config
import
*
from
equipment.truck
import
TruckInfo
from
equipment.excavator
import
ExcavatorInfo
from
equipment.dump
import
DumpInfo
from
equipment.truck
import
TruckInfo
truck
=
TruckInfo
()
excavator
=
ExcavatorInfo
()
dump
=
DumpInfo
()
excavator
=
ExcavatorInfo
()
truck
=
TruckInfo
()
# 调度类
class
Dispatcher
(
WalkManage
):
def
__init__
(
self
):
# 模拟挖机/卸载设备产量(防止调度修改真实产量)
self
.
sim_dump_real_mass
=
np
.
zeros
(
dump
.
get_dump_num
())
self
.
sim_excavator_real_mass
=
np
.
zeros
(
excavator
.
get_excavator_num
())
# 真实设备可用时间
self
.
cur_truck_reach_dump
=
np
.
zeros
(
truck
.
get_truck_num
())
self
.
cur_truck_reach_excavator
=
np
.
zeros
(
truck
.
get_truck_num
())
...
...
@@ -39,12 +34,11 @@ class Dispatcher(WalkManage):
self
.
cur_truck_ava_time
=
np
.
zeros
(
truck
.
get_truck_num
())
# 模拟矿卡可用时间
self
.
sim_truck_ava_time
=
np
.
zeros
(
truck
.
get_truck_num
())
# 模拟各设备可用时间(防止调度修改真实
产量
)
# 模拟各设备可用时间(防止调度修改真实)
self
.
sim_excavator_ava_time
=
np
.
zeros
(
excavator
.
get_excavator_num
())
self
.
sim_dump_ava_time
=
np
.
zeros
(
dump
.
get_dump_num
())
# 挖机/卸载设备预计产量(包含正在驶往挖机/卸载设备那部分矿卡的载重)
self
.
pre_dump_real_mass
=
np
.
zeros
(
dump
.
get_dump_num
())
self
.
pre_excavator_real_mass
=
np
.
zeros
(
excavator
.
get_excavator_num
())
# 维护一个矿卡调度表
self
.
Seq
=
[[]
for
_
in
range
(
truck
.
get_truck_num
())]
...
...
@@ -79,8 +73,8 @@ class Dispatcher(WalkManage):
self
.
opt_goto_excavator_traffic_flow
=
np
.
zeros
(
(
dump
.
get_dump_num
(),
excavator
.
get_excavator_num
())
)
self
.
path
=
PathPlanner
()
self
.
path
=
PathPlanner
()
# 设备数量
self
.
dump
=
get_value
(
"dynamic_dump_num"
)
...
...
@@ -98,11 +92,10 @@ class Dispatcher(WalkManage):
# 模拟实际产量(防止调度修改真实产量)
self
.
sim_dump_real_mass
=
np
.
zeros
(
self
.
dump
)
self
.
sim_excavator_real_mass
=
np
.
zeros
(
self
.
excavator
)
# 挖机和装载区的uuid与index的映射
self
.
excavator_uuid_to_index_dict
=
excavator
.
excavator_uuid_to_index_dict
self
.
dump_uuid_to_index_dict
=
dump
.
dump_uuid_to_index_dict
# 更新矿卡预计抵达目的地时间
def
update_truck_reach_time
(
self
):
try
:
...
...
@@ -315,12 +308,6 @@ class Dispatcher(WalkManage):
logger
.
error
(
"未知错误001"
)
logger
.
error
(
es
)
# print("驶往卸点实际载重")
# print(self.actual_goto_dump_traffic_flow)
# print("卸点路段行驶时间(h)")
# print((self.distance_to_dump.reshape(dynamic_excavator_num, dynamic_dump_num) / (1000 * empty_speed)))
# print("驶往卸点实际车流")
# print(self.actual_goto_dump_traffic_flow)
logger
.
info
(
"驶往卸点实际载重"
)
logger
.
info
(
self
.
actual_goto_dump_traffic_flow
)
...
...
@@ -336,26 +323,6 @@ class Dispatcher(WalkManage):
logger
.
info
(
"________________loading_task_time__________"
)
logger
.
info
(
loading_task_time
)
# self.actual_goto_excavator_traffic_flow = (
# self.actual_goto_excavator_traffic_flow
# / (
# self.distance_to_excavator.reshape(
# dynamic_dump_num, dynamic_excavator_num
# )
# / (1000 * heavy_speed)
# + np.expand_dims(loading_task_time, axis=0).repeat(
# dynamic_dump_num, axis=0
# )
# )
# )
# print("驶往挖机实际载重")
# print(self.actual_goto_excavator_traffic_flow)
# print("挖机路段行驶时间(h)")
# print((self.distance_to_excavator.reshape(dynamic_excavator_num, dynamic_dump_num) / (1000 * heavy_speed)))
# print("驶往挖机实际车流")
# print(self.actual_goto_excavator_traffic_flow)
logger
.
info
(
"驶往挖机实际载重"
)
logger
.
info
(
self
.
actual_goto_excavator_traffic_flow
)
logger
.
info
(
"挖机路段行驶时间(h)"
)
...
...
@@ -370,21 +337,10 @@ class Dispatcher(WalkManage):
logger
.
info
(
"驶往挖机实际车流"
)
logger
.
info
(
self
.
actual_goto_excavator_traffic_flow
)
def
Saturation_transport_value
(
self
):
# dump_target_mass = 5000
# excavator_target_mass = 5000
def
cur_real_mass
(
self
):
self
.
cur_excavator_real_mass
=
np
.
zeros
(
self
.
excavator
)
self
.
cur_dump_real_mass
=
np
.
zeros
(
self
.
dump
)
# traf_para = Traffic_para(self.excavator, self.dump, self.excavator, self.dump)
num_load
=
len
(
set
(
update_load_area
()))
num_unload
=
len
(
set
(
update_unload_area
()))
traf_para
=
Traffic_para
(
num_load
,
num_unload
,
self
.
excavator
,
self
.
dump
)
self
.
excavator_target_mass
=
traf_para
.
get_target_excavator_mass
()
self
.
dump_target_mass
=
traf_para
.
get_target_dump_mass
()
self
.
excavator_uuid_to_index_dict
=
excavator
.
excavator_uuid_to_index_dict
now
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
...
...
@@ -395,7 +351,8 @@ class Dispatcher(WalkManage):
join
(
Equipment
,
LoadInfo
.
dump_id
==
Equipment
.
equipment_id
)
.
\
filter
(
Equipment
.
id
==
excavator_id
,
LoadInfo
.
time
>
now
)
.
\
order_by
(
LoadInfo
.
time
.
desc
())
.
all
():
self
.
cur_excavator_real_mass
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
+=
query
.
load_weight
self
.
cur_excavator_real_mass
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
=
\
self
.
cur_excavator_real_mass
[
self
.
excavator_uuid_to_index_dict
[
excavator_id
]]
+
query
.
load_weight
for
dump_id
in
self
.
dump_uuid_to_index_dict
.
keys
():
# print(excavator_id)
...
...
@@ -403,20 +360,29 @@ class Dispatcher(WalkManage):
join
(
Equipment
,
LoadInfo
.
dump_id
==
Equipment
.
equipment_id
)
.
\
filter
(
Equipment
.
id
==
dump_id
,
LoadInfo
.
time
>
now
)
.
\
order_by
(
LoadInfo
.
time
.
desc
())
.
all
():
self
.
cur_dump_real_mass
[
self
.
dump_uuid_to_index_dict
[
dump_id
]]
+=
query
.
load_weight
self
.
cur_dump_real_mass
[
self
.
dump_uuid_to_index_dict
[
dump_id
]]
=
\
self
.
cur_dump_real_mass
[
self
.
dump_uuid_to_index_dict
[
dump_id
]]
+
query
.
load_weight
# # 卸载目标产量
# # self.dump_target_mass = (np.array(session_mysql.query(Dump.target_mass).all())).flatten()
# self.dump_target_mass = np.full(self.dump, dump_target_mass)
#
# # 挖机目标产量
# # self.excavator_target_mass = (np.array(session_mysql.query(Excavator.target_mass).all())).flatten()
# self.excavator_target_mass = np.full(self.excavator, excavator_target_mass)
def
pre_real_mass
(
self
):
try
:
self
.
pre_dump_real_mass
=
copy
.
deepcopy
(
self
.
cur_dump_real_mass
)
self
.
pre_excavator_real_mass
=
copy
.
deepcopy
(
self
.
cur_excavator_real_mass
)
# logger.info(f'卸点饱和度:{(1 - self.sim_dump_real_mass / self.dump_target_mass)}')
# logger.info(f'电铲饱和度:{(1 - self.sim_excavator_real_mass / self.excavator_target_mass)}')
return
self
.
sim_dump_real_mass
,
self
.
sim_dump_real_mass
,
\
self
.
dump_target_mass
,
self
.
excavator_target_mass
for
i
in
range
(
self
.
truck
):
task
=
truck
.
get_truck_current_task
()[
self
.
truck_index_to_uuid_dict
[
i
]]
end_area_index
=
truck
.
get_truck_current_trip
()[
i
][
1
]
# 若矿卡正常行驶,需要将该部分载重计入实时产量
if
task
in
empty_task_set
:
self
.
pre_excavator_real_mass
[
end_area_index
]
=
self
.
pre_excavator_real_mass
[
end_area_index
]
+
self
.
payload
[
i
]
elif
task
in
heavy_task_set
:
self
.
pre_dump_real_mass
[
end_area_index
]
=
self
.
pre_dump_real_mass
[
end_area_index
]
+
self
.
payload
[
i
]
else
:
pass
except
Exception
as
es
:
logger
.
error
(
"挖机/卸点预计装载量计算异常"
)
logger
.
error
(
es
)
def
para_period_update
(
self
):
...
...
@@ -447,8 +413,7 @@ class Dispatcher(WalkManage):
# 计算理想车流
(
self
.
opt_goto_dump_traffic_flow
,
self
.
opt_goto_excavator_traffic_flow
,)
=
traffic_flow_plan
()
print
(
"输出理想车流"
)
print
(
self
.
opt_goto_dump_traffic_flow
,
self
.
opt_goto_excavator_traffic_flow
,)
# 矿卡抵达时间
excavator_reach_list
,
dump_reach_list
=
self
.
update_truck_reach_time
()
...
...
@@ -472,10 +437,14 @@ class Dispatcher(WalkManage):
self
.
sim_excavator_ava_time
=
copy
.
deepcopy
(
self
.
cur_excavator_ava_time
)
self
.
sim_dump_ava_time
=
copy
.
deepcopy
(
self
.
cur_dump_ava_time
)
# 电铲\卸载点产量更新
self
.
sim_dump_real_mass
=
copy
.
deepcopy
(
self
.
pre_dump_real_mass
)
self
.
sim_shovel_real_mass
=
copy
.
deepcopy
(
self
.
pre_excavator_real_mass
)
def
reset
(
self
):
# 模拟挖机/卸载设备产量(防止调度修改真实产量)
self
.
sim_dump_real_mass
=
np
.
zeros
(
dump
.
get_dump_num
())
self
.
sim_excavator_real_mass
=
np
.
zeros
(
excavator
.
get_excavator_num
())
#
# 模拟挖机/卸载设备产量(防止调度修改真实产量)
#
self.sim_dump_real_mass = np.zeros(dump.get_dump_num())
#
self.sim_excavator_real_mass = np.zeros(excavator.get_excavator_num())
# 真实设备可用时间
self
.
cur_truck_reach_dump
=
np
.
zeros
(
truck
.
get_truck_num
())
self
.
cur_truck_reach_excavator
=
np
.
zeros
(
truck
.
get_truck_num
())
...
...
@@ -488,9 +457,9 @@ class Dispatcher(WalkManage):
# 模拟各设备可用时间(防止调度修改真实产量)
self
.
sim_excavator_ava_time
=
np
.
zeros
(
excavator
.
get_excavator_num
())
self
.
sim_dump_ava_time
=
np
.
zeros
(
dump
.
get_dump_num
())
# 挖机/卸载设备预计产量(包含正在驶往挖机/卸载设备那部分矿卡的载重)
self
.
pre_dump_real_mass
=
np
.
zeros
(
dump
.
get_dump_num
())
self
.
pre_excavator_real_mass
=
np
.
zeros
(
excavator
.
get_excavator_num
())
#
#
挖机/卸载设备预计产量(包含正在驶往挖机/卸载设备那部分矿卡的载重)
#
self.pre_dump_real_mass = np.zeros(dump.get_dump_num())
#
self.pre_excavator_real_mass = np.zeros(excavator.get_excavator_num())
# 维护一个矿卡调度表
self
.
Seq
=
[[]
for
_
in
range
(
truck
.
get_truck_num
())]
...
...
@@ -558,10 +527,7 @@ class Dispatcher(WalkManage):
target
=
0
(
cur_dump_mass
,
cur_excavator_mass
,
\
target_dump_mass
,
target_excavator_mass
)
=
self
.
Saturation_transport_value
()
# self.sim_dump_real_mass, self.sim_dump_real_mass, \
# self.excavator_target_mass, self.dump_target_mass
if
task
==
-
2
:
try
:
...
...
@@ -588,7 +554,7 @@ class Dispatcher(WalkManage):
else
:
transport_value
=
self
.
cost_park_to_excavator
print
(
"self.cost_park_to_excavator"
,
self
.
cost_park_to_excavator
)
print
(
"self.cost_park_to_excavator"
,
self
.
cost_park_to_excavator
)
logger
.
info
(
"transport_value"
)
logger
.
info
(
transport_value
)
...
...
@@ -640,7 +606,6 @@ class Dispatcher(WalkManage):
logger
.
info
(
"卸载点理想车流"
)
logger
.
info
(
self
.
opt_goto_dump_traffic_flow
[
int
(
trip
[
1
]),
:])
logger
.
info
(
"空载trip"
)
logger
.
info
(
trip
)
logger
.
info
(
"物料类型"
)
...
...
@@ -666,15 +631,14 @@ class Dispatcher(WalkManage):
transport_value
=
self
.
cost_to_dump
[:,
int
(
trip
[
1
])]
else
:
# transport_value = (self.actual_goto_dump_traffic_flow[int(trip[1]), :] + 0.001) \
# / (self.opt_goto_dump_traffic_flow[int(trip[1]), :] + 0.001
)
transport_value
=
cur_dump_mass
/
target_dump_mass
transport_value
=
(
self
.
cur_dump_real_mass
/
self
.
dump_target_mass
)
*
(
self
.
cost_to_dump
[:,
int
(
trip
[
1
])]
)
logger
.
info
(
"transport_value"
)
logger
.
info
(
transport_value
)
logger
.
info
(
"dump_material_bind_modify"
)
logger
.
info
(
truck
.
dump_material_bind_modify
[
truck_index
])
target
=
np
.
argmin
(
transport_value
+
truck
.
dump_material_bind_modify
[
truck_index
])
logger
.
info
(
"车流比:"
)
logger
.
info
((
self
.
actual_goto_dump_traffic_flow
[
int
(
trip
[
1
]),
:]
+
0.001
)
\
...
...
@@ -754,25 +718,24 @@ class Dispatcher(WalkManage):
if
rule3
and
rule4
:
transport_value
=
self
.
cost_to_excavator
[
int
(
trip
[
1
]),
:]
else
:
# transport_value = (self.actual_goto_excavator_traffic_flow[trip[1], :] + 0.001) \
# / (self.opt_goto_excavator_traffic_flow[trip[1], :] + 0.001)
transport_value
=
cur_excavator_mass
/
target_excavator_mass
transport_value
=
(
self
.
cur_excavator_real_mass
/
self
.
excavator_target_mass
)
\
*
(
self
.
cost_to_excavator
[
int
(
trip
[
1
]),
:])
logger
.
info
(
"transport_value"
)
logger
.
info
(
transport_value
)
target
=
np
.
argmin
(
transport_value
+
truck
.
excavator_exclude_modify
[
truck_index
]
+
truck
.
excavator_material_bind_modify
[
truck_index
])
+
truck
.
excavator_exclude_modify
[
truck_index
]
+
truck
.
excavator_material_bind_modify
[
truck_index
])
except
Exception
as
es
:
logger
.
info
(
"trip出错1"
)
logger
.
info
(
es
)
logger
.
info
(
"trip出错1"
)
logger
.
info
(
es
)
try
:
logger
.
info
(
"车流比:"
)
logger
.
info
(
(
self
.
actual_goto_excavator_traffic_flow
[
trip
[
1
],
:]
+
0.001
)
/
(
self
.
opt_goto_excavator_traffic_flow
[
trip
[
1
],
:]
+
0.001
))
logger
.
info
(
"车流比:"
)
logger
.
info
(
(
self
.
actual_goto_excavator_traffic_flow
[
trip
[
1
],
:]
+
0.001
)
/
(
self
.
opt_goto_excavator_traffic_flow
[
trip
[
1
],
:]
+
0.001
))
except
Exception
as
es
:
logger
.
info
(
"trip出错2"
)
logger
.
info
(
es
)
...
...
@@ -791,7 +754,7 @@ class Dispatcher(WalkManage):
self
.
reset
()
print
(
"self.cur_truck_ava_time"
,
self
.
cur_truck_ava_time
)
#
print("self.cur_truck_ava_time", self.cur_truck_ava_time)
# try:
...
...
@@ -818,6 +781,60 @@ class Dispatcher(WalkManage):
print
(
truck
.
truck_priority
)
temp
=
copy
.
deepcopy
(
self
.
cur_truck_ava_time
)
-
truck
.
truck_priority
dynamic_dump_num
=
get_value
(
"dynamic_dump_num"
)
# try:
rule3
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
3
)
.
first
()
if
not
rule3
.
disabled
:
try
:
for
dump_index
in
range
(
dynamic_dump_num
):
unload_area_id
=
unload_area_index_to_uuid_dict
[
self
.
dump_index_to_unload_area_index_dict
[
dump_index
]]
unload_ability
=
session_postgre
.
query
(
DumpArea
)
.
filter_by
(
Id
=
unload_area_id
)
.
first
()
.
UnloadAbililty
# self.dump_strength[dump_index] = unload_ability # 卸载设备最大卸载能力,单位吨/小时
self
.
dump_target_mass
[
dump_index
]
=
8
*
unload_ability
if
unload_ability
<
200
:
raise
Exception
(
"卸载点卸载能力异常"
)
except
Exception
as
es
:
logger
.
error
(
'卸点目标卸载量计算异常'
)
rule4
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
4
)
.
first
()
if
not
rule4
.
disabled
:
try
:
for
excavator_index
in
range
(
len
(
self
.
excavator_index_to_uuid_dict
)):
load_ability
=
session_mysql
.
query
(
EquipmentSpec
.
mining_abililty
)
.
\
join
(
Equipment
,
Equipment
.
equipment_spec
==
EquipmentSpec
.
id
)
.
\
filter
(
Equipment
.
id
==
self
.
excavator_index_to_uuid_dict
[
excavator_index
])
.
first
()
# self.excavator_strength[excavator_index] = load_ability.mining_abililty
self
.
excavator_target_mass
[
excavator_index
]
=
8
*
load_ability
.
mining_abililty
if
load_ability
.
mining_abililty
<
100
:
raise
Exception
(
"挖机装载能力异常"
)
except
Exception
as
es
:
logger
.
error
(
'挖机目标装载量计算异常'
)
logger
.
info
(
'挖机目标'
)
logger
.
info
(
self
.
excavator_target_mass
)
logger
.
info
(
'卸点目标'
)
logger
.
info
(
self
.
dump_target_mass
)
self
.
cur_real_mass
()
self
.
pre_real_mass
()
logger
.
info
(
'当前挖机装载'
)
logger
.
info
(
self
.
cur_excavator_real_mass
)
logger
.
info
(
'当前卸点装载'
)
logger
.
info
(
self
.
cur_dump_real_mass
)
# logger.info('挖机饱和度')写·
# logger.info(self.cur_excavator_real_mass, self.excavator_target_mass)
# logger.info('卸点饱和度')
# logger.info(self.cur_dump_real_mass / self.dump_target_mass)
# 读取实际产量
# 读取预计产量
try
:
# 没有启动的矿卡加上一个很大的值,降低其优先级
for
i
in
range
(
trucks
):
...
...
@@ -835,20 +852,22 @@ class Dispatcher(WalkManage):
for
truck_index
in
index
:
if
len
(
Seq
[
truck_index
])
>
0
:
# try:
task
=
truck_current_task
[
truck
.
truck_index_to_uuid_dict
[
truck_index
]]
try
:
task
=
truck_current_task
[
truck
.
truck_index_to_uuid_dict
[
truck_index
]]
# 矿卡结束当前派车计划后的目的地
end_eq_index
=
truck_current_trip
[
truck_index
][
1
]
# 矿卡结束当前派车计划后的目的地
end_eq_index
=
truck_current_trip
[
truck_index
][
1
]
# 调用调度函数,得到最优目的地序号
target_eq_index
=
self
.
truck_schedule
(
truck
.
truck_index_to_uuid_dict
[
truck_index
])
# 调用调度函数,得到最优目的地序号
target_eq_index
=
self
.
truck_schedule
(
truck
.
truck_index_to_uuid_dict
[
truck_index
])
# 写入Seq序列
Seq
[
truck_index
][
1
]
=
target_eq_index
# except Exception as es:
# logger.error(f'矿卡 {truck_uuid_to_name_dict[self.truck_index_to_uuid_dict[truck_index]]} 派车计划计算异常')
# logger.error(es)
# 写入Seq序列
Seq
[
truck_index
][
1
]
=
target_eq_index
except
Exception
as
es
:
logger
.
error
(
f
'矿卡 {truck_uuid_to_name_dict[self.truck_index_to_uuid_dict[truck_index]]} 派车计划计算异常'
)
logger
.
error
(
es
)
try
:
...
...
@@ -900,7 +919,7 @@ class Dispatcher(WalkManage):
record
[
"isdeleted"
]
=
False
record
[
"creator"
]
=
item
.
creator
record
[
"createtime"
]
=
item
.
createtime
.
strftime
(
"
%
b
%
d,
%
Y
%
H
:
%
M:
%
S
%
p"
)
"
%
b
%
d,
%
Y
%
I
:
%
M:
%
S
%
p"
)
elif
task
in
heavy_task_set
:
item
=
(
session_mysql
.
query
(
Dispatch
)
...
...
@@ -913,7 +932,7 @@ class Dispatcher(WalkManage):
record
[
"isdeleted"
]
=
False
record
[
"creator"
]
=
item
.
creator
record
[
"createtime"
]
=
item
.
createtime
.
strftime
(
"
%
b
%
d,
%
Y
%
H
:
%
M:
%
S
%
p"
)
"
%
b
%
d,
%
Y
%
I
:
%
M:
%
S
%
p"
)
elif
task
==
-
2
:
item
=
(
session_mysql
.
query
(
Dispatch
)
...
...
@@ -926,7 +945,7 @@ class Dispatcher(WalkManage):
record
[
"isdeleted"
]
=
False
record
[
"creator"
]
=
item
.
creator
record
[
"createtime"
]
=
item
.
createtime
.
strftime
(
"
%
b
%
d,
%
Y
%
H
:
%
M:
%
S
%
p"
)
"
%
b
%
d,
%
Y
%
I
:
%
M:
%
S
%
p"
)
else
:
pass
...
...
@@ -1038,3 +1057,4 @@ if __name__ == "__main__":
dispatcher
=
Dispatcher
()
main
(
10
,
dispatcher
)
\ No newline at end of file
traffic_flow/traffic_flow_info.py
View file @
b68d9546
...
...
@@ -115,6 +115,7 @@ class Traffic_para(WalkManage):
# 设置挖机信息
def
extract_excavator_info
(
self
):
try
:
rule4
=
session_mysql
.
query
(
DispatchRule
)
.
filter_by
(
id
=
4
)
.
first
()
if
not
rule4
.
disabled
:
...
...
@@ -129,7 +130,6 @@ class Traffic_para(WalkManage):
else
:
self
.
excavator_strength
=
np
.
full
(
self
.
num_of_excavator
,
5000
)
for
excavator_index
in
range
(
len
(
self
.
excavator_index_to_uuid_dict
)):
# self.excavator_strength[excavator_index] = 1000 # 挖机最大装载能力,单位吨/小时
self
.
grade_loading_array
[
excavator_index
]
=
100
# 挖机装载物料品位
self
.
excavator_priority_coefficient
[
excavator_index
]
=
1
# 挖机优先级
...
...
traffic_flow/traffic_flow_planner.py
View file @
b68d9546
...
...
@@ -170,6 +170,7 @@ def traffic_flow_plan():
walk_time_to_dump
=
traffic_programme_para
.
walk_time_to_dump
truck_total_num
=
traffic_programme_para
.
truck_total_num
print
(
w_ij
,
s_ij
,
b_excavator
,
b_dump
)
res
=
transportation_problem_slove
(
coefficient_goto_dump
,
coefficient_goto_excavator
,
w_ij
,
s_ij
,
b_excavator
,
b_dump
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment