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