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
40c4ed07
Commit
40c4ed07
authored
Feb 01, 2023
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增车辆空载及重载周期调度
parent
42011c50
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
71 deletions
+72
-71
algorithm.py
alg/algorithm.py
+1
-2
group.py
core/group.py
+68
-66
submit.py
core/submit.py
+1
-2
gothrough_digging.py
gothrough/gothrough_digging.py
+2
-1
No files found.
alg/algorithm.py
View file @
40c4ed07
...
...
@@ -369,8 +369,7 @@ class DistributionRatio(object):
@desc:计算分流配比模式下,卡车与卸载区的对应关系
"""
# TODO:
# 统一与预期等待时间的接口
# TODO: 统一与预期等待时间的接口
def
__init__
(
self
,
exactor_id
,
truck
):
self
.
truck
=
truck
...
...
core/group.py
View file @
40c4ed07
...
...
@@ -490,8 +490,7 @@ class GroupDispatcher:
truck_dispatch
[
i
]
=
[
next_exactor_id
,
next_unload_area_id
]
def
semi_dynamic_mode
(
self
,
i
,
s
,
truck_dispatch
,
truck_info
,
truck_task
,
truck_trip
):
# TODO:
# 和全智能调度很像,是否可以合并合;
# TODO:和全智能调度很像,是否可以合并合;
# 加入二次调度;
if
truck_task
in
[
-
2
,
3
,
4
,
5
]:
...
...
@@ -526,7 +525,34 @@ class GroupDispatcher:
def
full_dynamic_mode
(
self
,
i
:
str
,
s
:
AlgorithmBase
,
truck_dispatch
:
Mapping
[
str
,
List
[
str
]],
truck_info
:
CurrentTruck
,
truck_task
:
int
,
truck_trip
:
List
[
int
]):
# 车辆停止或者车辆位于卸载区内, 调度车辆前往装载区
if
truck_task
in
[
-
2
,
4
,
5
]:
if
truck_task
in
[
-
2
,
3
,
4
,
5
]:
if
truck_task
==
3
and
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
:
if
self
.
group
.
topo
is
not
None
:
try
:
truck_locate
=
self
.
group
.
truck
.
get_truck_locate_dict
()[
i
]
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆位置信息丢失"
)
self
.
logger
.
error
(
es
)
truck_dispatch
[
i
]
=
[
None
,
None
]
return
try
:
truck_is_temp
=
self
.
group
.
truck
.
truck_is_temp
[
i
]
except
Exception
as
es
:
truck_is_temp
=
False
self
.
logger
.
error
(
"车辆临时字段异常"
)
self
.
logger
.
error
(
es
)
self
.
logger
.
info
(
f
'车辆位置 {truck_locate}'
)
self
.
logger
.
info
(
f
'车辆状态 {self.group.truck.truck_current_state[i]}'
)
self
.
logger
.
info
(
f
'车辆临时 {truck_is_temp} {type(truck_is_temp)}'
)
# 车辆当前位于交叉路口前,且排队等待
if
(
truck_locate
in
self
.
group
.
topo
.
cross_bf_lanes
)
and
(
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
)
\
and
(
not
truck_is_temp
):
# self.redispatch_to_dump(i, truck_dispatch, truck_locate, truck_trip)
self
.
redispatcher
.
redispatch_to_dump
(
i
,
truck_dispatch
,
truck_locate
,
truck_trip
)
else
:
pass
else
:
try
:
if
i
in
self
.
group
.
truck
.
truck_excavator_bind
:
try
:
...
...
@@ -557,44 +583,8 @@ class GroupDispatcher:
self
.
logger
.
error
(
"重载车辆全智能模式-计算异常"
)
self
.
logger
.
error
(
es
)
# 车辆位于装载区内, 调度车辆前往卸载区
elif
truck_task
in
[
1
,
2
]:
try
:
next_excavator_id
=
get_value
(
"excavator_index_to_uuid_dict"
)[
truck_trip
[
-
1
]]
next_unload_area_value
=
s
.
solve
(
truck_info
)
# self.logger.info(f'车辆 {truck_id}')
# self.logger.info(f'group distance {self.to_unload_area_distance}')
# self.logger.info(f'walk available {self.group_walk_available}')
#
# self.logger.info(self.unload_area_uuid_index_dict)
# self.logger.info(self.excavator_uuid_index_dict)
if
i
in
self
.
group
.
truck
.
truck_dump_bind
:
dump_uuid_to_unload_area_uuid_dict
=
get_value
(
"dump_uuid_to_unload_area_uuid_dict"
)
next_unload_area_id
=
dump_uuid_to_unload_area_uuid_dict
[
self
.
group
.
truck
.
truck_dump_bind
[
i
]]
else
:
tmp
=
self
.
group
.
group_walk_available
[
self
.
group
.
excavator_uuid_index_dict
[
next_excavator_id
],
:]
.
flatten
()
# self.logger.info(f'group_walk_available_pick {tmp}')
# self.logger.info(f'next_excavator_id {next_excavator_id}')
# self.logger.info(next_unload_area_value)
next_unload_area_value
*=
self
.
group
.
group_walk_available
[
self
.
group
.
excavator_uuid_index_dict
[
next_excavator_id
],
:]
.
flatten
()
# self.logger.info(next_unload_area_value)
min_index
=
np
.
argmin
(
next_unload_area_value
)
next_unload_area_id
=
self
.
group
.
unload_area_uuid_index_dict
.
inverse
[
min_index
]
self
.
logger
.
info
(
f
'目标卸点 {min_index} {next_unload_area_id}'
)
# next_excavator_id = self.excavator_uuid_index_dict.inverse[truck_trip[-1]]
truck_dispatch
[
i
]
=
[
next_excavator_id
,
next_unload_area_id
]
except
Exception
as
es
:
self
.
logger
.
error
(
"空载车辆全智能模式-计算异常"
)
self
.
logger
.
error
(
es
.
__traceback__
.
tb_lineno
)
self
.
logger
.
error
(
es
)
truck_dispatch
[
i
]
=
[
None
,
None
]
elif
truck_task
==
0
:
elif
truck_task
in
[
0
,
1
,
2
]:
if
truck_task
==
0
and
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
:
if
self
.
group
.
topo
is
not
None
:
if
i
in
self
.
group
.
truck
.
get_truck_locate_dict
():
truck_locate
=
self
.
group
.
truck
.
get_truck_locate_dict
()[
i
]
...
...
@@ -621,40 +611,53 @@ class GroupDispatcher:
self
.
logger
.
info
(
truck_is_temp
)
# if (truck_locate in self.topo.cross_bf_lanes) and (self.truck.truck_current_state[truck_id] == 2) \
# and (not truck_is_temp):
if
(
truck_locate
in
self
.
group
.
topo
.
cross_bf_lanes
)
and
(
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
):
if
(
truck_locate
in
self
.
group
.
topo
.
cross_bf_lanes
)
and
(
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
):
self
.
logger
.
info
(
"触发二次调度"
)
# self.redispatch_to_excavator(i, truck_dispatch, truck_locate)
self
.
redispatcher
.
redispatch_to_excavator
(
i
,
truck_dispatch
,
truck_locate
)
else
:
pass
elif
truck_task
==
3
:
if
self
.
group
.
topo
is
not
None
:
else
:
try
:
truck_locate
=
self
.
group
.
truck
.
get_truck_locate_dict
()[
i
]
next_excavator_id
=
get_value
(
"excavator_index_to_uuid_dict"
)[
truck_trip
[
-
1
]]
next_unload_area_value
=
s
.
solve
(
truck_info
)
# self.logger.info(f'车辆 {truck_id}')
# self.logger.info(f'group distance {self.to_unload_area_distance}')
# self.logger.info(f'walk available {self.group_walk_available}')
#
# self.logger.info(self.unload_area_uuid_index_dict)
# self.logger.info(self.excavator_uuid_index_dict)
if
i
in
self
.
group
.
truck
.
truck_dump_bind
:
dump_uuid_to_unload_area_uuid_dict
=
get_value
(
"dump_uuid_to_unload_area_uuid_dict"
)
next_unload_area_id
=
dump_uuid_to_unload_area_uuid_dict
[
self
.
group
.
truck
.
truck_dump_bind
[
i
]]
else
:
tmp
=
self
.
group
.
group_walk_available
[
self
.
group
.
excavator_uuid_index_dict
[
next_excavator_id
],
:]
.
flatten
()
# self.logger.info(f'group_walk_available_pick {tmp}')
# self.logger.info(f'next_excavator_id {next_excavator_id}')
# self.logger.info(next_unload_area_value)
next_unload_area_value
*=
self
.
group
.
group_walk_available
[
self
.
group
.
excavator_uuid_index_dict
[
next_excavator_id
],
:]
.
flatten
()
# self.logger.info(next_unload_area_value)
min_index
=
np
.
argmin
(
next_unload_area_value
)
next_unload_area_id
=
self
.
group
.
unload_area_uuid_index_dict
.
inverse
[
min_index
]
self
.
logger
.
info
(
f
'目标卸点 {min_index} {next_unload_area_id}'
)
# next_excavator_id = self.excavator_uuid_index_dict.inverse[truck_trip[-1]]
truck_dispatch
[
i
]
=
[
next_excavator_id
,
next_unload_area_id
]
except
Exception
as
es
:
self
.
logger
.
error
(
"车辆位置信息丢失"
)
self
.
logger
.
error
(
"空载车辆全智能模式-计算异常"
)
self
.
logger
.
error
(
es
.
__traceback__
.
tb_lineno
)
self
.
logger
.
error
(
es
)
truck_dispatch
[
i
]
=
[
None
,
None
]
return
try
:
truck_is_temp
=
self
.
group
.
truck
.
truck_is_temp
[
i
]
except
Exception
as
es
:
truck_is_temp
=
False
self
.
logger
.
error
(
"车辆临时字段异常"
)
self
.
logger
.
error
(
es
)
self
.
logger
.
info
(
f
'车辆位置 {truck_locate}'
)
self
.
logger
.
info
(
f
'车辆状态 {self.group.truck.truck_current_state[i]}'
)
self
.
logger
.
info
(
f
'车辆临时 {truck_is_temp} {type(truck_is_temp)}'
)
# 车辆当前位于交叉路口前,且排队等待
if
(
truck_locate
in
self
.
group
.
topo
.
cross_bf_lanes
)
and
(
self
.
group
.
truck
.
truck_current_state
[
i
]
==
2
)
\
and
(
not
truck_is_temp
):
# self.redispatch_to_dump(i, truck_dispatch, truck_locate, truck_trip)
self
.
redispatcher
.
redispatch_to_dump
(
i
,
truck_dispatch
,
truck_locate
,
truck_trip
)
else
:
pass
# TODO:车辆在空载状态是否应该如何计算,是计算下一次卸载区还是继续计算当前最优挖机
# def redispatch_to_dump(self, truck_id: str, truck_dispatch: Mapping[str, List[str]], truck_locate: str, truck_trip: List[int]):
# """
...
...
@@ -858,8 +861,7 @@ class ReDispatcher:
# current_load_area_id = DispatchInfo.excavator_load_dict[current_excavator_id]
load_area_dict
,
load_area_lane_dict
=
self
.
group
.
topo
.
get_load_target_node_real
(
truck_locate
,
current_load_area_id
,
True
)
# TODO
# topo 放到 group 里面不太合理
# TODO:topo 放到 group 里面不太合理
self
.
logger
.
info
(
"所有可达装载区"
)
self
.
logger
.
info
(
load_area_dict
)
...
...
core/submit.py
View file @
40c4ed07
...
...
@@ -121,8 +121,7 @@ class DispatchSubmission:
record
=
redis_format
(
truck_id
,
group_id
,
str
(
uuid
.
uuid1
()),
item
)
# TODO:
# 判断了两次是否拥堵,需要改善
# TODO: 判断了两次是否拥堵,需要改善
if
self
.
topo
is
not
None
:
...
...
gothrough/gothrough_digging.py
View file @
40c4ed07
...
...
@@ -342,7 +342,8 @@ def truck_pass_first_area(truck_id, lane_id, closer_entrance_node_id, further_en
size
=
len
(
que
)
for
_
in
range
(
size
):
cur_node
=
que
.
popleft
()
if
cur_node
is
None
:
continue
if
cur_node
is
None
:
continue
logger
.
info
(
cur_node
)
if
cur_node
==
closer_entrance_node_id
:
logger
.
info
(
"closer_entrance_node"
)
...
...
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