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
3bc88530
Commit
3bc88530
authored
Jan 14, 2018
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Batches: implementation of where-to (max WIP) rule
parent
43791a98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
65 deletions
+119
-65
dream/plugins/Batches/ReadSkilledOperators.py
dream/plugins/Batches/ReadSkilledOperators.py
+2
-1
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+117
-64
No files found.
dream/plugins/Batches/ReadSkilledOperators.py
View file @
3bc88530
...
...
@@ -73,7 +73,8 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
"name"
:
"SkilledRouter01"
,
"outputSolutions"
:
1
,
"twoPhaseSearch"
:
int
(
data
[
'general'
].
get
(
'twoPhaseSearch'
,
0
)),
"checkCondition"
:
1
"checkCondition"
:
1
,
"whereToMaxWIP"
:
data
[
'general'
].
get
(
'whereToMaxWIP'
,
0
)
==
'Yes'
,
}
return
data
dream/simulation/SkilledOperatorRouter.py
View file @
3bc88530
...
...
@@ -30,6 +30,8 @@ import simpy
from
OperatorRouter
import
Router
from
opAss_LPmethod
import
opAss_LP
import
Globals
import
logging
from
copy
import
deepcopy
# ===========================================================================
# Class that handles the Operator Behavior
...
...
@@ -57,6 +59,8 @@ class SkilledRouter(Router):
self
.
tool
=
tool
self
.
checkCondition
=
checkCondition
self
.
twoPhaseSearch
=
twoPhaseSearch
self
.
whereToMaxWIP
=
kw
.
get
(
'whereToMaxWIP'
,
False
)
self
.
logger
=
logging
.
getLogger
(
"dream.platform"
)
#===========================================================================
# the initialize method
...
...
@@ -212,6 +216,55 @@ class SkilledRouter(Router):
import
time
startLP
=
time
.
time
()
if
LPFlag
:
# XXX if the solution is empty, how do we allocate?
if
self
.
whereToMaxWIP
and
self
.
previousSolution
:
self
.
logger
.
info
(
'------> %s'
%
self
.
env
.
now
)
solution
=
{}
maxWIP
=-
1
minWIP
=
float
(
'inf'
)
machineWithMaxWIP
=
None
operatorToMove
=
None
# first, find the machine with max wip
for
stationId
,
stationDict
in
self
.
availableStationsDict
.
iteritems
():
wip
=
stationDict
[
'WIP'
]
assignedOperatorList
=
[
x
for
x
in
self
.
previousSolution
\
if
self
.
previousSolution
[
x
]
==
stationId
\
and
x
in
self
.
availableOperatorList
]
assert
len
(
assignedOperatorList
)
in
(
0
,
1
),
assignedOperatorList
if
wip
>
maxWIP
and
not
assignedOperatorList
:
machineWithMaxWIP
=
stationId
solution
=
{}
# First, search for an operator that was not
# previously assigned, and can handle the maxWIP station
for
operatorId
in
self
.
availableOperatorList
:
if
operatorId
not
in
self
.
previousSolution
\
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]
in
self
.
operators
.
get
(
'operatorId'
,
[]):
operatorToMove
=
operatorId
# Then, search for the machine with Min WIP that has skill for
# maxWIP station
if
not
operatorToMove
:
for
stationId
,
stationDict
in
self
.
availableStationsDict
.
iteritems
():
wip
=
stationDict
[
'WIP'
]
assignedOperatorList
=
[
x
for
x
in
self
.
previousSolution
\
if
self
.
previousSolution
[
x
]
==
stationId
\
and
x
in
self
.
availableOperatorList
]
if
wip
<
minWIP
and
assignedOperatorList
\
and
self
.
availableStationsDict
[
machineWithMaxWIP
][
'stationID'
]:
operatorToMove
=
assignedOperatorList
[
0
]
# Copy previous solution for available operators
for
operatorId
,
stationId
in
self
.
previousSolution
.
iteritems
():
if
operatorId
in
self
.
availableOperatorList
:
solution
[
operatorId
]
=
self
.
previousSolution
[
operatorId
]
# move the operator that was identified to be moved to maxWIP
if
operatorToMove
and
machineWithMaxWIP
:
solution
[
operatorToMove
]
=
machineWithMaxWIP
self
.
logger
.
info
(
'moved %s to %s'
%
(
operatorToMove
,
machineWithMaxWIP
))
self
.
logger
.
info
(
solution
)
else
:
if
self
.
twoPhaseSearch
:
# remove all the blocked machines from the available stations
# and create another dict only with them
...
...
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