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
c8302415
Commit
c8302415
authored
Jun 24, 2022
by
z5335534 Ao Guo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Good so far2
parent
ab16d8ce
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
19 deletions
+37
-19
algorithm.cpython-37.pyc
alg/__pycache__/algorithm.cpython-37.pyc
+0
-0
algorithm.py
alg/algorithm.py
+2
-0
config.json
config.json
+1
-2
dispatcher.cpython-37.pyc
core/__pycache__/dispatcher.cpython-37.pyc
+0
-0
group.cpython-37.pyc
core/__pycache__/group.cpython-37.pyc
+0
-0
dispatcher.py
core/dispatcher.py
+7
-3
group.py
core/group.py
+20
-13
dispatchInfo.cpython-37.pyc
data/__pycache__/dispatchInfo.cpython-37.pyc
+0
-0
dispatchInfo.py
data/dispatchInfo.py
+7
-1
No files found.
alg/__pycache__/algorithm.cpython-37.pyc
View file @
c8302415
No preview for this file type
alg/algorithm.py
View file @
c8302415
...
...
@@ -158,6 +158,8 @@ class ExpectedTime(AlgorithmBase):
truck_id
=
truck_info
.
get_truck_id
()
truck_index
=
self
.
truck
.
truck_uuid_to_index_dict
[
truck_id
]
# task = truck_task
# trip = truck_trip
trip
=
truck_info
.
get_trip
()
...
...
config.json
View file @
c8302415
...
...
@@ -27,4 +27,4 @@
"host"
:
"192.168.9.152"
,
"password"
:
"Huituo@123"
}
}
\ No newline at end of file
}
core/__pycache__/dispatcher.cpython-37.pyc
View file @
c8302415
No preview for this file type
core/__pycache__/group.cpython-37.pyc
View file @
c8302415
No preview for this file type
core/dispatcher.py
View file @
c8302415
...
...
@@ -51,9 +51,11 @@ class Dispatcher:
Generate and initialize dispatch groups.
:return: None
"""
for
group_id
in
DispatchInfo
.
group_excavator_dict
.
keys
():
group
=
Group
(
group_id
,
self
.
truck
,
self
.
pre_sch
)
self
.
group_list
.
append
(
group
)
groups
=
DispatchInfo
.
get_all_group
()
for
group_id
in
groups
:
if
group_id
not
in
self
.
group_list
:
group
=
Group
(
group_id
,
self
.
truck
,
self
.
pre_sch
)
self
.
group_list
.
append
(
group
)
def
group_info_update
(
self
):
"""
...
...
@@ -68,6 +70,8 @@ class Dispatcher:
Group dispatching logic.
:return:
"""
a
=
len
(
self
.
group_list
)
aa
=
self
.
group_list
for
group
in
self
.
group_list
:
truck_dispatch_plan_dict
=
group
.
group_dispatch
(
ExpectedTime
)
...
...
core/group.py
View file @
c8302415
...
...
@@ -20,6 +20,7 @@ from bidict import bidict
from
alg.algorithm
import
AlgorithmBase
import
numpy
as
np
# from settings import get_logger
class
CurrentTruck
:
""" class for the information of current dispatching truck.
...
...
@@ -69,8 +70,8 @@ class Group:
self
.
pre_sch
=
pre_sch
# group devices
self
.
excavator
s
=
{}
# excavator_id -> unload_area_id
self
.
unload_area
s
=
{}
# unload_area_id -> load_area_id
self
.
excavator
=
{}
# excavator_id -> unload_area_id
self
.
unload_area
=
{}
# unload_area_id -> load_area_id
self
.
truck_set
=
set
()
# truck_id
# road network info.
...
...
@@ -104,11 +105,11 @@ class Group:
"""
# update group devices
# DispatchInfo.update_device_group_structure()
self
.
excavator
s
=
{}
self
.
unload_area
s
=
{}
self
.
excavator
=
{}
self
.
unload_area
=
{}
self
.
truck_set
=
set
()
self
.
excavator
s
=
DispatchInfo
.
get_excavator
(
self
.
group_id
)
self
.
unload_area
s
=
DispatchInfo
.
get_unload_area
(
self
.
group_id
)
self
.
excavator
=
DispatchInfo
.
get_excavator
(
self
.
group_id
)
self
.
unload_area
=
DispatchInfo
.
get_unload_area
(
self
.
group_id
)
self
.
truck_set
=
DispatchInfo
.
get_truck_set
(
self
.
group_id
)
def
update_group_road_network
(
self
):
...
...
@@ -135,11 +136,11 @@ class Group:
self
.
unload_area_uuid_index_dict
=
{}
self
.
truck_uuid_index_dict
=
{}
for
i
in
range
(
len
(
self
.
excavator
s
)):
self
.
excavator_uuid_index_dict
[
list
(
self
.
excavator
s
)[
i
]]
=
i
for
i
in
range
(
len
(
self
.
excavator
)):
self
.
excavator_uuid_index_dict
[
list
(
self
.
excavator
)[
i
]]
=
i
for
i
in
range
(
len
(
self
.
unload_area
s
)):
self
.
unload_area_uuid_index_dict
[
list
(
self
.
unload_area
s
)[
i
]]
=
i
for
i
in
range
(
len
(
self
.
unload_area
)):
self
.
unload_area_uuid_index_dict
[
list
(
self
.
unload_area
)[
i
]]
=
i
b
=
self
.
truck_set
for
i
in
range
(
len
(
self
.
truck_set
)):
...
...
@@ -180,8 +181,14 @@ class Group:
truck_trip
=
self
.
truck
.
get_truck_current_trip
()[
self
.
truck_uuid_index_dict
[
i
]]
truck_task
=
self
.
truck
.
get_truck_current_task
()[
i
]
truck_info
=
CurrentTruck
(
i
,
self
.
group_id
,
truck_trip
,
truck_task
)
# a = truck_info._truck_id
# b = truck_info._trip
# c = truck_info._task
# d = truck_info._group_id
if
truck_task
in
[
-
2
,
3
,
4
]:
next_excavator_value
=
s
.
solve
(
i
,
truck_info
)
next_excavator_value
=
s
.
solve
(
truck_info
)
# next_excavator_value = s.solve(i, truck_task, truck_trip)
# min_index = next_excavator_list.index(min(next_excavator_list))
min_index
=
np
.
argmin
(
next_excavator_value
)
next_excavator_id
=
self
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
...
...
@@ -192,7 +199,7 @@ class Group:
truck_dispatch
[
i
]
=
[
next_excavator_id
,
next_unload_area_id
]
if
truck_task
in
[
0
,
1
]:
next_unload_area_value
=
s
.
solve
(
i
)
next_unload_area_value
=
s
.
solve
(
truck_info
)
min_index
=
np
.
argmin
(
next_unload_area_value
)
next_unload_area_id
=
self
.
unload_area_uuid_index_dict
.
inverse
[
min_index
]
next_excavator_id
=
self
.
excavator_uuid_index_dict
.
inverse
[
truck_trip
[
-
1
]]
...
...
@@ -207,7 +214,7 @@ class Group:
truck_task
=
self
.
truck
.
get_truck_current_task
()[
i
]
truck_info
=
CurrentTruck
(
i
,
self
.
group_id
,
truck_trip
,
truck_task
)
if
truck_task
in
[
-
2
,
3
,
4
]:
next_excavator_value
=
s
.
solve
(
i
,
truck_info
)
next_excavator_value
=
s
.
solve
(
truck_info
)
# min_index = next_excavator_list.index(min(next_excavator_list))
min_index
=
np
.
argmin
(
next_excavator_value
)
next_excavator_id
=
self
.
excavator_uuid_index_dict
.
inverse
[
min_index
]
...
...
data/__pycache__/dispatchInfo.cpython-37.pyc
View file @
c8302415
No preview for this file type
data/dispatchInfo.py
View file @
c8302415
...
...
@@ -110,7 +110,7 @@ class DispatchInfo:
# update excavator_id <-> group_id && unload_area_id <-> group_id && truck_id <-> group_id
try
:
for
item
in
session_mysql
.
query
(
DispatchSetting
)
.
filter_by
(
group_type
=
1
)
.
all
():
for
item
in
session_mysql
.
query
(
DispatchSetting
)
.
all
():
# add excavator
if
item
.
group_id
not
in
cls
.
group_excavator_dict
.
keys
():
...
...
@@ -136,6 +136,9 @@ class DispatchInfo:
cls
.
group_truck_dict
[
item
.
group_id
]
.
append
(
item
.
truck_id
)
cls
.
truck_group_dict
[
item
.
truck_id
]
=
item
.
group_id
print
(
"存在的分组"
)
print
(
cls
.
group_excavator_dict
.
keys
())
except
Exception
as
es
:
logger
.
error
(
"挖机/卸载区/矿卡与group_id映射更新异常"
)
logger
.
error
(
es
)
...
...
@@ -236,6 +239,9 @@ class DispatchInfo:
logger
.
error
(
"路网距离更新异常-调度部分和路网部分不一致"
)
logger
.
error
(
es
)
@classmethod
def
get_all_group
(
cls
):
return
set
(
cls
.
group_excavator_dict
.
keys
())
@classmethod
def
get_group_mode
(
cls
,
group_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