Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
integrated-scheduling-v3
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
1
Merge Requests
1
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-v3
Commits
db6ebc5f
Commit
db6ebc5f
authored
Jun 06, 2023
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次调度触发方式优化
parent
20500a86
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
18 deletions
+41
-18
dispatcher.py
core/dispatcher.py
+2
-4
group.py
core/group.py
+16
-2
submit.py
core/submit.py
+17
-12
topo_graph.py
graph/topo_graph.py
+6
-0
No files found.
core/dispatcher.py
View file @
db6ebc5f
...
@@ -32,8 +32,7 @@ class Dispatcher:
...
@@ -32,8 +32,7 @@ class Dispatcher:
self
.
logger
=
get_logger
(
"zxt.dispatcher"
)
self
.
logger
=
get_logger
(
"zxt.dispatcher"
)
self
.
redispatch_active
=
active
self
.
redispatch_active
=
active
if
self
.
redispatch_active
:
if
self
.
redispatch_active
:
self
.
topo
=
Topo
()
self
.
topo
=
graph_construct
()
self
.
topo
.
generate_topo_graph
()
else
:
else
:
self
.
topo
=
None
self
.
topo
=
None
self
.
submission
=
DispatchSubmission
(
dump
,
excavator
,
truck
,
self
.
topo
)
self
.
submission
=
DispatchSubmission
(
dump
,
excavator
,
truck
,
self
.
topo
)
...
@@ -49,8 +48,7 @@ class Dispatcher:
...
@@ -49,8 +48,7 @@ class Dispatcher:
self
.
truck
.
truck_para_period_update
(
self
.
dump
,
self
.
excavator
)
self
.
truck
.
truck_para_period_update
(
self
.
dump
,
self
.
excavator
)
self
.
truck
.
state_period_update
()
self
.
truck
.
state_period_update
()
if
self
.
redispatch_active
:
if
self
.
redispatch_active
:
self
.
topo
=
Topo
()
self
.
topo
=
graph_construct
()
self
.
topo
.
generate_topo_graph
()
else
:
else
:
self
.
topo
=
None
self
.
topo
=
None
...
...
core/group.py
View file @
db6ebc5f
...
@@ -114,7 +114,7 @@ class CurrentTruck:
...
@@ -114,7 +114,7 @@ class CurrentTruck:
def
__init__
(
self
,
truck_id
:
str
,
group_id
:
str
,
trip
:
List
[
int
],
task
:
int
,
state
:
int
,
def
__init__
(
self
,
truck_id
:
str
,
group_id
:
str
,
trip
:
List
[
int
],
task
:
int
,
state
:
int
,
lane_locate
:
str
,
name
:
str
,
combined_excavator
:
str
,
combined_dump
:
str
,
lane_locate
:
str
,
name
:
str
,
combined_excavator
:
str
,
combined_dump
:
str
,
combined_load_area
:
str
,
combined_unload_area
:
str
):
combined_load_area
:
str
,
combined_unload_area
:
str
,
redispatch
:
bool
):
self
.
_lane_locate
=
lane_locate
self
.
_lane_locate
=
lane_locate
self
.
_truck_id
=
truck_id
self
.
_truck_id
=
truck_id
self
.
_group_id
=
group_id
self
.
_group_id
=
group_id
...
@@ -127,6 +127,7 @@ class CurrentTruck:
...
@@ -127,6 +127,7 @@ class CurrentTruck:
self
.
has_changed
=
False
self
.
has_changed
=
False
self
.
_combined_load_area
=
combined_load_area
self
.
_combined_load_area
=
combined_load_area
self
.
_combined_unload_area
=
combined_unload_area
self
.
_combined_unload_area
=
combined_unload_area
self
.
redispatch
=
redispatch
def
get_truck_id
(
self
):
def
get_truck_id
(
self
):
return
self
.
_truck_id
return
self
.
_truck_id
...
@@ -164,6 +165,9 @@ class CurrentTruck:
...
@@ -164,6 +165,9 @@ class CurrentTruck:
def
get_combined_unload_area
(
self
):
def
get_combined_unload_area
(
self
):
return
self
.
_combined_unload_area
return
self
.
_combined_unload_area
def
get_redispatch
(
self
):
return
self
.
redispatch
class
Group
:
class
Group
:
"""
"""
...
@@ -576,6 +580,7 @@ class GroupDispatcher:
...
@@ -576,6 +580,7 @@ class GroupDispatcher:
self
.
logger
.
info
(
"触发二次调度"
)
self
.
logger
.
info
(
"触发二次调度"
)
# self.redispatch_to_dump(truck_id, truck_dispatch, truck_locate, truck_trip)
# self.redispatch_to_dump(truck_id, truck_dispatch, truck_locate, truck_trip)
try
:
try
:
truck_info
.
redispatch
=
\
self
.
redispatcher
.
redispatch_to_dump
(
truck_id
,
truck_dispatch
,
truck_locate
,
truck_trip
)
self
.
redispatcher
.
redispatch_to_dump
(
truck_id
,
truck_dispatch
,
truck_locate
,
truck_trip
)
except
Exception
as
es
:
except
Exception
as
es
:
self
.
logger
.
error
(
"二次调度至卸载点失败"
)
self
.
logger
.
error
(
"二次调度至卸载点失败"
)
...
@@ -608,6 +613,7 @@ class GroupDispatcher:
...
@@ -608,6 +613,7 @@ class GroupDispatcher:
self
.
logger
.
info
(
"触发二次调度"
)
self
.
logger
.
info
(
"触发二次调度"
)
try
:
try
:
truck_info
.
redispatch
=
\
self
.
redispatcher
.
redispatch_to_excavator
(
truck_id
,
truck_dispatch
,
truck_locate
,
self
.
redispatcher
.
redispatch_to_excavator
(
truck_id
,
truck_dispatch
,
truck_locate
,
truck_trip
,
truck_info
)
truck_trip
,
truck_info
)
except
Exception
as
es
:
except
Exception
as
es
:
...
@@ -791,7 +797,7 @@ class GroupDispatcher:
...
@@ -791,7 +797,7 @@ class GroupDispatcher:
self
.
group
.
truck
.
get_truck_current_state
()[
truck_id
],
truck_lane_locate
,
self
.
group
.
truck
.
get_truck_current_state
()[
truck_id
],
truck_lane_locate
,
truck_name
,
combined_excavator
=
current_truck_goto_excavator_id
,
truck_name
,
combined_excavator
=
current_truck_goto_excavator_id
,
combined_dump
=
current_truck_goto_dump_id
,
combined_load_area
=
current_load_area_id
,
combined_dump
=
current_truck_goto_dump_id
,
combined_load_area
=
current_load_area_id
,
combined_unload_area
=
current_unload_area_id
)
combined_unload_area
=
current_unload_area_id
,
redispatch
=
False
)
self
.
group
.
truck_info_list
[
truck_id
]
=
truck_info
self
.
group
.
truck_info_list
[
truck_id
]
=
truck_info
...
@@ -1037,9 +1043,13 @@ class ReDispatcher:
...
@@ -1037,9 +1043,13 @@ class ReDispatcher:
self
.
logger
.
info
(
f
'二次调度结果 {truck_id}'
)
self
.
logger
.
info
(
f
'二次调度结果 {truck_id}'
)
self
.
logger
.
info
(
truck_dispatch
[
truck_id
])
self
.
logger
.
info
(
truck_dispatch
[
truck_id
])
return
True
else
:
else
:
self
.
logger
.
info
(
f
'二次调度未变更'
)
self
.
logger
.
info
(
f
'二次调度未变更'
)
return
False
def
redispatch_to_dump
(
self
,
truck_id
:
str
,
truck_dispatch
:
Mapping
[
str
,
List
[
str
]],
truck_locate
:
str
,
def
redispatch_to_dump
(
self
,
truck_id
:
str
,
truck_dispatch
:
Mapping
[
str
,
List
[
str
]],
truck_locate
:
str
,
truck_trip
:
List
[
int
],
truck_info
:
CurrentTruck
):
truck_trip
:
List
[
int
],
truck_info
:
CurrentTruck
):
"""
"""
...
@@ -1092,9 +1102,13 @@ class ReDispatcher:
...
@@ -1092,9 +1102,13 @@ class ReDispatcher:
self
.
logger
.
info
(
truck_dispatch
[
truck_id
])
self
.
logger
.
info
(
truck_dispatch
[
truck_id
])
# res = redispatch_request(truck_id, next_excavator_id, next_unload_area_id)
# res = redispatch_request(truck_id, next_excavator_id, next_unload_area_id)
# self.logger.info(res)
# self.logger.info(res)
return
True
else
:
else
:
self
.
logger
.
info
(
f
'二次调度未变更'
)
self
.
logger
.
info
(
f
'二次调度未变更'
)
return
False
def
get_best_dump
(
self
,
current_dump_id
,
unload_area_dict
):
def
get_best_dump
(
self
,
current_dump_id
,
unload_area_dict
):
min_trip_time
=
10000000
min_trip_time
=
10000000
best_dump_id
=
current_dump_id
best_dump_id
=
current_dump_id
...
...
core/submit.py
View file @
db6ebc5f
...
@@ -76,14 +76,14 @@ class DispatchSubmission:
...
@@ -76,14 +76,14 @@ class DispatchSubmission:
else
:
else
:
self
.
logger
.
info
(
"动态调度模式"
)
self
.
logger
.
info
(
"动态调度模式"
)
self
.
dynamic_dispatch_mode
(
dispatch_seq
,
group_id
,
record
,
truck_info
.
get_sate
(),
self
.
dynamic_dispatch_mode
(
dispatch_seq
,
group_id
,
record
,
truck_info
.
get_sate
(),
truck_info
.
get_task
(),
truck_id
)
truck_info
.
get_task
(),
truck_id
,
truck_info
.
get_redispatch
()
)
# except Exception as es:
# except Exception as es:
# self.logger.error("调度结果写入异常")
# self.logger.error("调度结果写入异常")
# self.logger.error(f"调度结果:{dispatch_seq}")
# self.logger.error(f"调度结果:{dispatch_seq}")
# self.logger.error(es)
# self.logger.error(es)
def
dynamic_dispatch_mode
(
self
,
dispatch_seq
,
group_id
,
record
,
state
,
task
,
truck_id
):
def
dynamic_dispatch_mode
(
self
,
dispatch_seq
,
group_id
,
record
,
state
,
task
,
truck_id
,
redispatch
):
"""
"""
write dispatch plan in dynamic dispatch mode.
write dispatch plan in dynamic dispatch mode.
:param dispatch_seq:
:param dispatch_seq:
...
@@ -92,6 +92,7 @@ class DispatchSubmission:
...
@@ -92,6 +92,7 @@ class DispatchSubmission:
:param state:
:param state:
:param task:
:param task:
:param truck_id:
:param truck_id:
:param redispatch:
:return:
:return:
"""
"""
if
(
task
in
[
1
,
2
])
or
(
task
==
3
and
state
==
2
):
# 车辆位于装载区,或车辆重载等待
if
(
task
in
[
1
,
2
])
or
(
task
==
3
and
state
==
2
):
# 车辆位于装载区,或车辆重载等待
...
@@ -125,12 +126,14 @@ class DispatchSubmission:
...
@@ -125,12 +126,14 @@ class DispatchSubmission:
# TODO: 判断了两次是否拥堵,需要改善
# TODO: 判断了两次是否拥堵,需要改善
# # 车辆重载等待,且前方道路阻塞
# if self.topo is not None \
# and task == 3 \
# and truck_id in self.truck.get_truck_lane_locate_dict() \
# and self.truck.get_truck_lane_locate_dict()[truck_id] in self.topo.cross_bf_lanes:
# 车辆重载等待,且前方道路阻塞
# 车辆重载等待,且前方道路阻塞
if
self
.
topo
is
not
None
\
if
self
.
topo
is
not
None
and
redispatch
:
and
task
==
3
\
and
state
==
2
\
and
truck_id
in
self
.
truck
.
get_truck_lane_locate_dict
()
\
and
self
.
truck
.
get_truck_lane_locate_dict
()[
truck_id
]
in
self
.
topo
.
cross_bf_lanes
:
# try:
# try:
# if truck_id in self.truck.truck_is_temp and not self.truck.truck_is_temp[truck_id]:
# if truck_id in self.truck.truck_is_temp and not self.truck.truck_is_temp[truck_id]:
self
.
logger
.
info
(
"二次调度前往卸载区"
)
self
.
logger
.
info
(
"二次调度前往卸载区"
)
...
@@ -189,12 +192,14 @@ class DispatchSubmission:
...
@@ -189,12 +192,14 @@ class DispatchSubmission:
if
self
.
topo
is
not
None
:
if
self
.
topo
is
not
None
:
# # 车辆重载等待,且前方道路阻塞
# if self.topo is not None \
# and task == 0 \
# and truck_id in self.truck.get_truck_lane_locate_dict() \
# and self.truck.get_truck_lane_locate_dict()[truck_id] in self.topo.cross_bf_lanes:
# 车辆重载等待,且前方道路阻塞
# 车辆重载等待,且前方道路阻塞
if
self
.
topo
is
not
None
\
if
self
.
topo
is
not
None
and
redispatch
:
and
task
==
0
\
and
state
==
2
\
and
truck_id
in
self
.
truck
.
get_truck_lane_locate_dict
()
\
and
self
.
truck
.
get_truck_lane_locate_dict
()[
truck_id
]
in
self
.
topo
.
cross_bf_lanes
:
# 车辆停车等待
# 车辆停车等待
# try:
# try:
# if truck_id in self.truck.truck_is_temp and not self.truck.truck_is_temp[truck_id]:
# if truck_id in self.truck.truck_is_temp and not self.truck.truck_is_temp[truck_id]:
...
...
graph/topo_graph.py
View file @
db6ebc5f
...
@@ -310,6 +310,12 @@ class Topo():
...
@@ -310,6 +310,12 @@ class Topo():
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
es
)
self
.
logger
.
error
(
"备停区部分装载拓扑图生成失败"
)
self
.
logger
.
error
(
"备停区部分装载拓扑图生成失败"
)
# 更新交叉点
self
.
update_cross_nodes
()
# 更新交叉点前路段
self
.
update_cross_bf_lanes
()
"""
"""
unload source node for reschedule
unload source node for reschedule
"""
"""
...
...
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