Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
b92b8b78
Commit
b92b8b78
authored
Jan 28, 2018
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIXUPS: Batches: implementation of where-to (max WIP) rule
parent
3bc88530
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
8 deletions
+26
-8
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+26
-8
No files found.
dream/simulation/SkilledOperatorRouter.py
View file @
b92b8b78
...
@@ -216,16 +216,25 @@ class SkilledRouter(Router):
...
@@ -216,16 +216,25 @@ class SkilledRouter(Router):
import
time
import
time
startLP
=
time
.
time
()
startLP
=
time
.
time
()
if
LPFlag
:
if
LPFlag
:
# XXX if the solution is empty, how do we allocate?
if
self
.
whereToMaxWIP
and
self
.
previousSolution
:
if
self
.
whereToMaxWIP
and
self
.
previousSolution
:
self
.
logger
.
info
(
'---
---> %s'
%
self
.
env
.
now
)
self
.
logger
.
info
(
'---
> '
+
str
(
self
.
env
.
now
)
)
solution
=
{}
solution
=
{}
maxWIP
=-
1
maxWIP
=-
1
minWIP
=
float
(
'inf'
)
minWIP
=
float
(
'inf'
)
machineWithMaxWIP
=
None
machineWithMaxWIP
=
None
operatorToMove
=
None
operatorToMove
=
None
# Sort so that the ones closer to end win in ties
sorted_station_id_list
=
sorted
(
self
.
availableStationsDict
.
keys
(),
key
=
lambda
x
:
int
(
x
[
0
]),
reverse
=
True
)
# first, find the machine with max wip
# first, find the machine with max wip
for
stationId
,
stationDict
in
self
.
availableStationsDict
.
iteritems
():
for
stationId
in
sorted_station_id_list
:
stationDict
=
self
.
availableStationsDict
.
get
(
stationId
,
None
)
self
.
logger
.
info
(
stationDict
)
if
not
stationDict
:
continue
wip
=
stationDict
[
'WIP'
]
wip
=
stationDict
[
'WIP'
]
assignedOperatorList
=
[
assignedOperatorList
=
[
x
for
x
in
self
.
previousSolution
\
x
for
x
in
self
.
previousSolution
\
...
@@ -233,14 +242,18 @@ class SkilledRouter(Router):
...
@@ -233,14 +242,18 @@ class SkilledRouter(Router):
and
x
in
self
.
availableOperatorList
and
x
in
self
.
availableOperatorList
]
]
assert
len
(
assignedOperatorList
)
in
(
0
,
1
),
assignedOperatorList
assert
len
(
assignedOperatorList
)
in
(
0
,
1
),
assignedOperatorList
if
not
assignedOperatorList
:
self
.
logger
.
info
(
'%s has no operator'
%
stationId
)
if
wip
>
maxWIP
and
not
assignedOperatorList
:
if
wip
>
maxWIP
and
not
assignedOperatorList
:
machineWithMaxWIP
=
stationId
machineWithMaxWIP
=
stationId
maxWIP
=
wip
self
.
logger
.
info
(
machineWithMaxWIP
)
solution
=
{}
solution
=
{}
# First, search for an operator that was not
# First, search for an operator that was not
# previously assigned, and can handle the maxWIP station
# previously assigned, and can handle the maxWIP station
for
operatorId
in
self
.
availableOperatorList
:
for
operatorId
in
self
.
availableOperatorList
:
if
operatorId
not
in
self
.
previousSolution
\
if
operatorId
not
in
self
.
previousSolution
\
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]
in
self
.
operators
.
get
(
'operatorId'
,
[]):
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]
in
self
.
operators
.
get
(
operatorId
,
[]):
operatorToMove
=
operatorId
operatorToMove
=
operatorId
# Then, search for the machine with Min WIP that has skill for
# Then, search for the machine with Min WIP that has skill for
# maxWIP station
# maxWIP station
...
@@ -252,18 +265,23 @@ class SkilledRouter(Router):
...
@@ -252,18 +265,23 @@ class SkilledRouter(Router):
if
self
.
previousSolution
[
x
]
==
stationId
\
if
self
.
previousSolution
[
x
]
==
stationId
\
and
x
in
self
.
availableOperatorList
and
x
in
self
.
availableOperatorList
]
]
assert
len
(
assignedOperatorList
)
in
(
0
,
1
),
assignedOperatorList
if
wip
<
minWIP
and
assignedOperatorList
\
if
wip
<
minWIP
and
assignedOperatorList
\
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]:
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]
in
self
.
operators
.
get
(
assignedOperatorList
[
0
],
[])
:
operatorToMove
=
assignedOperatorList
[
0
]
operatorToMove
=
assignedOperatorList
[
0
]
minWIP
=
wip
# Copy previous solution for available operators
# Copy previous solution for available operators
for
operatorId
,
stationId
in
self
.
previousSolution
.
iteritems
():
for
operatorId
,
stationId
in
self
.
previousSolution
.
iteritems
():
if
operatorId
in
self
.
availableOperatorList
:
if
operatorId
in
self
.
availableOperatorList
:
solution
[
operatorId
]
=
self
.
previousSolution
[
operatorId
]
solution
[
operatorId
]
=
self
.
previousSolution
[
operatorId
]
# move the operator that was identified to be moved to maxWIP
# move the operator that was identified to be moved to maxWIP
if
operatorToMove
and
machineWithMaxWIP
:
if
operatorToMove
and
machineWithMaxWIP
and
maxWIP
>=
minWIP
:
solution
[
operatorToMove
]
=
machineWithMaxWIP
solution
[
operatorToMove
]
=
machineWithMaxWIP
self
.
logger
.
info
(
'moved %s to %s'
%
(
operatorToMove
,
machineWithMaxWIP
))
self
.
logger
.
info
(
'moved %s from %s to %s'
%
(
self
.
logger
.
info
(
solution
)
operatorToMove
,
self
.
previousSolution
.
get
(
operatorToMove
,
'idle'
),
machineWithMaxWIP
))
else
:
else
:
if
self
.
twoPhaseSearch
:
if
self
.
twoPhaseSearch
:
# remove all the blocked machines from the available stations
# remove all the blocked machines from the available stations
...
...
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