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
9d52e330
Commit
9d52e330
authored
Mar 05, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new activeQSorter for OperatorManagedJob
parent
f7b761c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
0 deletions
+125
-0
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+125
-0
No files found.
dream/simulation/OperatorManagedJob.py
View file @
9d52e330
...
@@ -67,3 +67,128 @@ class OperatorManagedJob(Operator):
...
@@ -67,3 +67,128 @@ class OperatorManagedJob(Operator):
# return False
# return False
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
return
len
(
self
.
Res
.
activeQ
)
<
self
.
capacity
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
# =======================================================================
# TODO: entityToGet is not updated for all stations, consider using it for all stations or withdraw the idea
def
activeQSorter
(
self
,
criterion
=
None
):
activeObjectQ
=
self
.
activeCallersList
if
criterion
==
None
:
criterion
=
self
.
schedulingRule
#if the schedulingRule is first in first out
if
criterion
==
"FIFO"
:
pass
#if the schedulingRule is based on a pre-defined priority
elif
criterion
==
"Priority"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
priority
)
#if the scheduling rule is time waiting (time waiting of machine
# TODO: consider that the timeLastEntityEnded is not a
# indicative identifier of how long the station was waiting
elif
criterion
==
'WT'
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
schedule
[
-
1
][
1
])
#if the schedulingRule is earliest due date
elif
criterion
==
"EDD"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
dueDate
)
#if the schedulingRule is earliest order date
elif
criterion
==
"EOD"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
orderDate
)
#if the schedulingRule is to sort Entities according to the stations they have to visit
elif
criterion
==
"NumStages"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
len
(
x
.
giver
.
getActiveObjectQueue
()[
0
].
remainingRoute
),
reverse
=
True
)
#if the schedulingRule is to sort Entities according to the their remaining processing time in the system
elif
criterion
==
"RPC"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
for
object
in
activeObjectQ
:
entity
=
object
.
giver
.
getActiveObjectQueue
()[
0
]
RPT
=
0
for
step
in
entity
.
remainingRoute
:
processingTime
=
step
.
get
(
'processingTime'
,
None
)
if
processingTime
:
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
remainingProcessingTime
=
RPT
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
remainingProcessingTime
,
reverse
=
True
)
#if the schedulingRule is to sort Entities according to longest processing time first in the next station
elif
criterion
==
"LPT"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
for
object
in
activeObjectQ
:
entity
=
object
.
giver
.
getActiveObjectQueue
()[
0
]
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
if
processingTime
:
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
else
:
entity
.
processingTimeInNextStation
=
0
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
processingTimeInNextStation
,
reverse
=
True
)
#if the schedulingRule is to sort Entities according to shortest processing time first in the next station
elif
criterion
==
"SPT"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
for
object
in
activeObjectQ
:
entity
=
object
.
giver
.
getActiveObjectQueue
()[
0
]
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
if
processingTime
:
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
else
:
entity
.
processingTimeInNextStation
=
0
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
processingTimeInNextStation
)
#if the schedulingRule is to sort Entities based on the minimum slackness
elif
criterion
==
"MS"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
for
object
in
activeObjectQ
:
object
.
giver
.
getActiveObjectQueue
()[
0
]
RPT
=
0
for
step
in
entity
.
remainingRoute
:
processingTime
=
step
.
get
(
'processingTime'
,
None
)
if
processingTime
:
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
remainingProcessingTime
=
RPT
activeObjectQ
.
sort
(
key
=
lambda
x
:
(
x
.
giver
.
getActiveObjectQueue
()[
0
].
dueDate
-
x
.
giver
.
getActiveObjectQueue
()[
0
].
remainingProcessingTime
))
#if the schedulingRule is to sort Entities based on the length of the following Queue
elif
criterion
==
"WINQ"
:
for
object
in
activeObjectQ
:
object
.
giver
.
sortEntitiesForOperator
(
self
)
from
Globals
import
G
for
object
in
activeObjectQ
:
entity
=
object
.
giver
.
getActiveObjectQueue
()[
0
]
nextObjIds
=
entity
.
remainingRoute
[
1
].
get
(
'stationIdsList'
,[])
for
obj
in
G
.
ObjList
:
if
obj
.
id
in
nextObjIds
:
nextObject
=
obj
entity
.
nextQueueLength
=
len
(
nextObject
.
getActiveObjectQueue
())
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
giver
.
getActiveObjectQueue
()[
0
].
nextQueueLength
)
else
:
assert
False
,
"Unknown scheduling criterion %r"
%
(
criterion
,
)
\ No newline at end of file
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