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
c81d437a
Commit
c81d437a
authored
Oct 18, 2022
by
张晓彤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化v2
parent
39eaec24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
28 additions
and
25 deletions
+28
-25
app.py
app.py
+1
-1
dispatcher.py
core/dispatcher.py
+0
-0
group.py
core/group.py
+0
-0
schedule.py
core/schedule.py
+3
-3
submit.py
core/submit.py
+0
-0
dispatchInfo.py
data/dispatchInfo.py
+12
-12
truck.py
equipment/truck.py
+4
-1
topo_graph.py
graph/topo_graph.py
+7
-7
redispatch.py
redispatch/redispatch.py
+1
-1
No files found.
app.py
View file @
c81d437a
...
...
@@ -9,7 +9,7 @@ from core.group import Group
from
flask_caching
import
Cache
from
alg.algorithm
import
ExpectedTime
from
data.dispatchInfo
import
DispatchInfo
from
core.
dispatcher
import
DispatchSubmission
from
core.
submit
import
DispatchSubmission
config
=
{
"DEBUG"
:
True
,
# some Flask specific configs
...
...
core/dispatcher.py
View file @
c81d437a
This diff is collapsed.
Click to expand it.
core/group.py
View file @
c81d437a
This diff is collapsed.
Click to expand it.
core/schedule.py
View file @
c81d437a
...
...
@@ -180,7 +180,7 @@ class PreSchedule:
# # 若挖机可用时间严重偏离,进行修正
# if abs(self.excavator_avl_time[excavator_index] - now) > 60:
# self.truck_avl_time[int(tmp[
i
][1])] = now
# self.truck_avl_time[int(tmp[
truck_id
][1])] = now
# if abs(self.excavator_avl_time[excavator_index] - now) > 60:
# self.excavator_avl_time[excavator_index] = now
...
...
@@ -252,8 +252,8 @@ class PreSchedule:
# # 若卸载设备可用时间严重偏离,进行修正
# if abs(self.dump_avl_time[dump_index] - now) > 60:
# self.dump_avl_time[dump_index] = now
# if abs(self.truck_avl_time[int(tmp[
i
][1])] - now) > 60:
# self.truck_avl_time[int(tmp[
i
][1])] = now
# if abs(self.truck_avl_time[int(tmp[
truck_id
][1])] - now) > 60:
# self.truck_avl_time[int(tmp[
truck_id
][1])] = now
count
=
0
self
.
logger
.
info
(
"update_dump_avl_time-dump_avl_ls"
)
...
...
core/submit.py
0 → 100644
View file @
c81d437a
This diff is collapsed.
Click to expand it.
data/dispatchInfo.py
View file @
c81d437a
...
...
@@ -349,10 +349,10 @@ class DispatchInfo:
# # unload->load distance
# unload_load_distance = np.zeros((len(unload_areas), len(load_areas)))
# for
i
in range(len(unload_areas)):
# for
truck_id
in range(len(unload_areas)):
# for j in range(len(load_areas)):
# distance = int(session_postgre.query(WalkTime).filter_by(unload_area_id=unload_areas[
i
], load_area_id=load_areas[j]).first().to_load_distance)
# unload_load_distance[
i
][j] = distance
# distance = int(session_postgre.query(WalkTime).filter_by(unload_area_id=unload_areas[
truck_id
], load_area_id=load_areas[j]).first().to_load_distance)
# unload_load_distance[
truck_id
][j] = distance
# cls.load_distance[item] = unload_load_distance
...
...
@@ -445,17 +445,17 @@ class DispatchInfo:
# cls.truck_uuid_index_dict = {}
# cls.dump_uuid_index_dict = {}
#
# for
i
in range(len(cls.group_excavator_dict[group_id])):
# cls.excavator_uuid_index_dict[group_id][list(cls.group_excavator_dict[group_id])[
i]] = i
# for
truck_id
in range(len(cls.group_excavator_dict[group_id])):
# cls.excavator_uuid_index_dict[group_id][list(cls.group_excavator_dict[group_id])[
truck_id]] = truck_id
#
# for
i
in range(len(cls.group_unload_area_dict[group_id])):
# cls.unload_area_uuid_index_dict[group_id][list(cls.group_unload_area_dict[group_id])[
i]] = i
# for
truck_id
in range(len(cls.group_unload_area_dict[group_id])):
# cls.unload_area_uuid_index_dict[group_id][list(cls.group_unload_area_dict[group_id])[
truck_id]] = truck_id
#
# for
i
in range(len(cls.group_dump_dict[group_id])):
# cls.dump_uuid_index_dict[group_id][list(cls.group_dump_dict[group_id])[
i]] = i
# for
truck_id
in range(len(cls.group_dump_dict[group_id])):
# cls.dump_uuid_index_dict[group_id][list(cls.group_dump_dict[group_id])[
truck_id]] = truck_id
#
# for
i
in range(len(cls.group_truck_dict[group_id])):
# cls.truck_uuid_index_dict[group_id][list(cls.group_truck_dict[group_id])[
i]] = i
# for
truck_id
in range(len(cls.group_truck_dict[group_id])):
# cls.truck_uuid_index_dict[group_id][list(cls.group_truck_dict[group_id])[
truck_id]] = truck_id
#
# # self.excavator_uuid_index_dict = bidict(DispatchInfo.excavator_uuid_to_index_dict[self.group_id])
# # self.unload_area_uuid_index_dict = bidict(DispatchInfo.unload_area_uuid_to_index_dict[self.group_id])
...
...
@@ -681,7 +681,7 @@ class DispatchInfo:
# @classmethod
# def get_group_road_info(cls,group_id, truck_info):
# if truck_info == 1:
# for
i
in group_excavator():
# for
truck_id
in group_excavator():
# pass
# for j in group_unload_area():
# pass
...
...
equipment/truck.py
View file @
c81d437a
...
...
@@ -148,7 +148,10 @@ class TruckInfo(WalkManage):
# try:
item
=
item
.
decode
(
encoding
=
"utf-8"
)
key_value_dict
=
redis2
.
hgetall
(
item
)
# reids str可以自动转为bytes
device_type
=
int
(
key_value_dict
[
str_to_byte
(
"type"
)])
if
str_to_byte
(
"type"
)
in
key_value_dict
:
device_type
=
int
(
key_value_dict
[
str_to_byte
(
"type"
)])
else
:
continue
if
device_type
==
1
:
if
truck_name_to_uuid_dict
[
item
]
in
self
.
dynamic_truck_set
:
# currentTask = int(key_value_dict[str_to_byte("currentTask")])
...
...
graph/topo_graph.py
View file @
c81d437a
...
...
@@ -163,7 +163,7 @@ class Topo():
# add [start_point, end_point, length, lane_id] to unload_saved_lane
unload_saved_lane
.
append
([
str
(
i_startpoint
),
str
(
i_endpoint
),
float
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
Id
=
i
)
.
first
()
.
Length
),
i
])
# son_lane_num = sum(1 for
i
in session_postgre.query(Lane).filter_by(StartNodeId = i_endpoint).all())
# son_lane_num = sum(1 for
truck_id
in session_postgre.query(Lane).filter_by(StartNodeId = i_endpoint).all())
son_lane_num
=
len
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
StartNodeId
=
i_endpoint
)
.
all
())
# 可以添加的节点:分叉口或终点
...
...
@@ -227,7 +227,7 @@ class Topo():
load_saved_lane
.
append
([
str
(
load_i_startpoint
),
str
(
load_i_endpoint
),
float
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
Id
=
i
)
.
first
()
.
Length
),
i
])
# son_lane_num = sum(1 for
i
in session_postgre.query(Lane).filter_by(StartNodeId = load_i_endpoint).all())
# son_lane_num = sum(1 for
truck_id
in session_postgre.query(Lane).filter_by(StartNodeId = load_i_endpoint).all())
son_lane_num
=
len
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
StartNodeId
=
load_i_endpoint
)
.
all
())
nodes
=
list
(
self
.
load_G
.
nodes
)
...
...
@@ -239,8 +239,8 @@ class Topo():
lanes
=
{}
for
lane_info
in
load_saved_lane
:
lanes
[
lane_info
[
-
1
]]
=
list
([
lane_info
[
2
],
lane_info
[
2
]])
# lanes.append(
i
[0])
# lanes.append(
i
[1])
# lanes.append(
truck_id
[0])
# lanes.append(
truck_id
[1])
# self.load_G.add_edge(load_saved_lane[0][0], load_saved_lane[-1][1], real_distance = sum(n[2] for n in load_saved_lane), lane = lanes)
self
.
load_G
.
add_edge
(
load_saved_lane
[
0
][
0
],
load_saved_lane
[
-
1
][
1
],
real_distance
=
sum
(
value
[
0
]
for
value
in
lanes
.
values
()),
...
...
@@ -275,7 +275,7 @@ class Topo():
load_saved_lane
.
append
([
str
(
load_i_startpoint
),
str
(
load_i_endpoint
),
float
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
Id
=
i
)
.
first
()
.
Length
),
i
])
# son_lane_num = sum(1 for
i
in session_postgre.query(Lane).filter_by(StartNodeId = load_i_endpoint).all())
# son_lane_num = sum(1 for
truck_id
in session_postgre.query(Lane).filter_by(StartNodeId = load_i_endpoint).all())
son_lane_num
=
len
(
session_postgre
.
query
(
Lane
)
.
filter_by
(
StartNodeId
=
load_i_endpoint
)
.
all
())
nodes
=
list
(
self
.
load_G
.
nodes
)
...
...
@@ -287,8 +287,8 @@ class Topo():
lanes
=
{}
for
lane_info
in
load_saved_lane
:
lanes
[
lane_info
[
-
1
]]
=
list
([
lane_info
[
2
],
lane_info
[
2
]])
# lanes.append(
i
[0])
# lanes.append(
i
[1])
# lanes.append(
truck_id
[0])
# lanes.append(
truck_id
[1])
# self.load_G.add_edge(load_saved_lane[0][0], load_saved_lane[-1][1], real_distance = sum(n[2] for n in load_saved_lane), lane = lanes)
self
.
load_G
.
add_edge
(
load_saved_lane
[
0
][
0
],
load_saved_lane
[
-
1
][
1
],
real_distance
=
sum
(
value
[
0
]
for
value
in
lanes
.
values
()),
...
...
redispatch/redispatch.py
View file @
c81d437a
...
...
@@ -17,7 +17,7 @@ from core.group import Group
from
flask_caching
import
Cache
from
alg.algorithm
import
ExpectedTime
from
data.dispatchInfo
import
DispatchInfo
from
core.
dispatcher
import
DispatchSubmission
from
core.
submit
import
DispatchSubmission
from
graph.graph_load
import
graph_construct
config
=
{
...
...
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