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
4bf0973b
Commit
4bf0973b
authored
Dec 02, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增锁定排斥功能
parent
12726f1c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
9 deletions
+42
-9
group.py
core/group.py
+33
-5
submit.py
core/submit.py
+0
-2
truck.py
equipment/truck.py
+9
-2
No files found.
core/group.py
View file @
4bf0973b
...
@@ -193,6 +193,10 @@ class Group:
...
@@ -193,6 +193,10 @@ class Group:
# material control
# material control
self
.
group_walk_available
=
None
self
.
group_walk_available
=
None
# device exclude
self
.
truck_excavator_exclude
=
set
()
self
.
truck_excavator_exclude_modify
=
{}
def
update_group_mode
(
self
):
def
update_group_mode
(
self
):
"""
"""
update group mode.
update group mode.
...
@@ -291,13 +295,33 @@ class Group:
...
@@ -291,13 +295,33 @@ class Group:
else
:
else
:
self
.
excavator_truck_bind
[
excavator_id
]
.
append
(
truck_id
)
self
.
excavator_truck_bind
[
excavator_id
]
.
append
(
truck_id
)
def
get_device_exclude
(
self
,
truck_id
):
def
update_device_exclude
(
self
):
"""
"""
get device exclude modify vector.
get device exclude modify vector.
:param truck_id: request truck id
:return:
:return:
"""
"""
pass
self
.
truck_excavator_exclude
=
{}
self
.
truck_excavator_exclude_modify
=
{}
for
truck_id
in
self
.
group_trucks
:
self
.
truck_excavator_exclude_modify
[
truck_id
]
=
np
.
zeros
(
len
(
self
.
group_excavators
))
if
truck_id
in
self
.
truck
.
truck_excavator_exclude
:
exclude_excavators
=
self
.
truck
.
truck_excavator_exclude
[
truck_id
]
else
:
continue
for
excavator_id
in
exclude_excavators
:
if
excavator_id
in
self
.
group_excavators
:
if
truck_id
not
in
self
.
truck_excavator_exclude
:
self
.
truck_excavator_exclude
[
truck_id
]
=
[
excavator_id
]
else
:
self
.
truck_excavator_exclude
[
truck_id
]
.
append
(
excavator_id
)
excavator_index
=
self
.
excavator_uuid_index_dict
[
excavator_id
]
self
.
truck_excavator_exclude_modify
[
truck_id
][
excavator_index
]
=
1000000
self
.
logger
.
info
(
"group.truck_excavator_exclude"
)
self
.
logger
.
info
(
self
.
truck_excavator_exclude_modify
)
def
info_update
(
self
):
def
info_update
(
self
):
"""
"""
...
@@ -309,6 +333,7 @@ class Group:
...
@@ -309,6 +333,7 @@ class Group:
self
.
update_group_device_map
()
self
.
update_group_device_map
()
self
.
update_group_road_network
()
self
.
update_group_road_network
()
self
.
update_device_material
()
self
.
update_device_material
()
self
.
update_device_exclude
()
class
GroupDispatcher
:
class
GroupDispatcher
:
...
@@ -477,7 +502,8 @@ class GroupDispatcher:
...
@@ -477,7 +502,8 @@ class GroupDispatcher:
else
:
else
:
next_excavator_value
=
s
.
solve
(
truck_info
)
next_excavator_value
=
s
.
solve
(
truck_info
)
# min_index = next_excavator_list.index(min(next_excavator_list))
# min_index = next_excavator_list.index(min(next_excavator_list))
min_index
=
np
.
argmin
(
next_excavator_value
)
self
.
logger
.
info
(
f
'车辆排斥修正 {i}, {self.group.truck_excavator_exclude_modify[i]}'
)
min_index
=
np
.
argmin
(
next_excavator_value
+
self
.
group
.
truck_excavator_exclude_modify
[
i
])
next_excavator_id
=
self
.
group
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
next_excavator_id
=
self
.
group
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
if
truck_task
==
-
2
:
if
truck_task
==
-
2
:
next_unload_area_id
=
"Park"
next_unload_area_id
=
"Park"
...
@@ -513,7 +539,9 @@ class GroupDispatcher:
...
@@ -513,7 +539,9 @@ class GroupDispatcher:
next_excavator_id
=
self
.
group
.
truck
.
truck_excavator_bind
[
i
]
next_excavator_id
=
self
.
group
.
truck
.
truck_excavator_bind
[
i
]
else
:
else
:
next_excavator_value
=
s
.
solve
(
truck_info
)
next_excavator_value
=
s
.
solve
(
truck_info
)
min_index
=
np
.
argmin
(
next_excavator_value
)
self
.
logger
.
info
(
f
'车辆排斥修正 {i}, {self.group.truck_excavator_exclude_modify[i]}'
)
min_index
=
np
.
argmin
(
next_excavator_value
+
self
.
group
.
truck_excavator_exclude_modify
[
i
])
# min_index = np.argmin(next_excavator_value)
next_excavator_id
=
self
.
group
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
next_excavator_id
=
self
.
group
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
self
.
logger
.
info
(
f
'目标挖机 {min_index} {next_excavator_id}'
)
self
.
logger
.
info
(
f
'目标挖机 {min_index} {next_excavator_id}'
)
...
...
core/submit.py
View file @
4bf0973b
...
@@ -246,10 +246,8 @@ class DispatchSubmission:
...
@@ -246,10 +246,8 @@ class DispatchSubmission:
self
.
logger
.
info
(
"dispatch_plan_dict"
)
self
.
logger
.
info
(
"dispatch_plan_dict"
)
self
.
logger
.
info
(
dispatch_plan_dict
)
self
.
logger
.
info
(
dispatch_plan_dict
)
print
(
group
.
truck_info_list
)
for
truck_id
,
dispatch_plan
in
dispatch_plan_dict
.
items
():
for
truck_id
,
dispatch_plan
in
dispatch_plan_dict
.
items
():
print
(
truck_id
)
try
:
try
:
self
.
logger
.
info
(
f
'======================================= 调度车辆 ======================================='
)
self
.
logger
.
info
(
f
'======================================= 调度车辆 ======================================='
)
self
.
truck_dispatch_to_redis
(
truck_id
,
group
.
truck_info_list
[
truck_id
],
dispatch_plan
,
group
.
group_mode
)
self
.
truck_dispatch_to_redis
(
truck_id
,
group
.
truck_info_list
[
truck_id
],
dispatch_plan
,
group
.
group_mode
)
...
...
equipment/truck.py
View file @
4bf0973b
...
@@ -619,6 +619,8 @@ class TruckInfo(WalkManage):
...
@@ -619,6 +619,8 @@ class TruckInfo(WalkManage):
self
.
truck_excavator_bind
=
{}
self
.
truck_excavator_bind
=
{}
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
excavator_id
))
.
first
()
item
=
session_mysql
.
query
(
Equipment
)
.
filter_by
(
EQUIPMENT_ID
=
int
(
excavator_id
))
.
first
()
if
item
is
None
:
continue
if
item
.
BIND_LIST
is
not
None
:
if
item
.
BIND_LIST
is
not
None
:
for
truck_id
in
json
.
loads
(
item
.
BIND_LIST
):
for
truck_id
in
json
.
loads
(
item
.
BIND_LIST
):
self
.
truck_excavator_bind
[
truck_id
]
=
excavator_id
self
.
truck_excavator_bind
[
truck_id
]
=
excavator_id
...
@@ -644,7 +646,7 @@ class TruckInfo(WalkManage):
...
@@ -644,7 +646,7 @@ class TruckInfo(WalkManage):
except
Exception
as
es
:
except
Exception
as
es
:
session_postgre
.
rollback
()
session_postgre
.
rollback
()
session_mysql
.
rollback
()
session_mysql
.
rollback
()
if
rule5
.
disabled
==
0
:
if
not
rule5
.
disabled
:
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
for
excavator_id
in
get_value
(
"dynamic_excavator_set"
):
item
=
(
item
=
(
session_mysql
.
query
(
Equipment
)
session_mysql
.
query
(
Equipment
)
...
@@ -654,7 +656,12 @@ class TruckInfo(WalkManage):
...
@@ -654,7 +656,12 @@ class TruckInfo(WalkManage):
if
item
is
not
None
:
if
item
is
not
None
:
for
truck_id
in
self
.
dynamic_truck_set
:
for
truck_id
in
self
.
dynamic_truck_set
:
if
truck_uuid_to_name_dict
[
truck_id
]
not
in
item
.
BIND_LIST
:
if
truck_uuid_to_name_dict
[
truck_id
]
not
in
item
.
BIND_LIST
:
self
.
truck_excavator_exclude
[
truck_id
]
=
excavator_id
if
truck_id
not
in
self
.
truck_excavator_exclude
:
self
.
truck_excavator_exclude
[
truck_id
]
=
set
()
self
.
truck_excavator_exclude
[
truck_id
]
.
add
(
excavator_id
)
else
:
self
.
truck_excavator_exclude
[
truck_id
]
.
add
(
excavator_id
)
# self.truck_excavator_exclude[truck_id] = excavator_id
self
.
excavator_exclude_modify
[
self
.
excavator_exclude_modify
[
self
.
truck_uuid_to_index_dict
[
truck_id
]
self
.
truck_uuid_to_index_dict
[
truck_id
]
][
][
...
...
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