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
e7709ded
Commit
e7709ded
authored
Feb 25, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sortEntities criteria of operator corrected
parent
d2250e3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
dream/simulation/Operator.py
dream/simulation/Operator.py
+30
-14
No files found.
dream/simulation/Operator.py
View file @
e7709ded
...
@@ -68,66 +68,82 @@ class Operator(Repairman):
...
@@ -68,66 +68,82 @@ class Operator(Repairman):
if
criterion
==
"FIFO"
:
if
criterion
==
"FIFO"
:
pass
pass
#if the schedulingRule is based on a pre-defined priority
#if the schedulingRule is based on a pre-defined priority
# TODO: entityToGet is not updated for all available Objects
elif
criterion
==
"Priority"
:
elif
criterion
==
"Priority"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
priority
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
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'
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
timeLastEntityEnded
)
#if the schedulingRule is earliest due date
#if the schedulingRule is earliest due date
elif
criterion
==
"EDD"
:
elif
criterion
==
"EDD"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
dueDate
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
dueDate
)
#if the schedulingRule is earliest order date
#if the schedulingRule is earliest order date
elif
criterion
==
"EOD"
:
elif
criterion
==
"EOD"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
orderDate
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
orderDate
)
#if the schedulingRule is to sort Entities according to the stations they have to visit
#if the schedulingRule is to sort Entities according to the stations they have to visit
elif
criterion
==
"NumStages"
:
elif
criterion
==
"NumStages"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
len
(
x
.
remainingRoute
),
reverse
=
True
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
len
(
x
.
entityToGet
.
remainingRoute
),
reverse
=
True
)
#if the schedulingRule is to sort Entities according to the their remaining processing time in the system
#if the schedulingRule is to sort Entities according to the their remaining processing time in the system
# TODO: have to compare the entitiesToGet
elif
criterion
==
"RPC"
:
elif
criterion
==
"RPC"
:
for
entity
in
activeObjectQ
:
for
object
in
activeObjectQ
:
entity
=
object
.
entityToGet
RPT
=
0
RPT
=
0
for
step
in
entity
.
remainingRoute
:
for
step
in
entity
.
remainingRoute
:
processingTime
=
step
.
get
(
'processingTime'
,
None
)
processingTime
=
step
.
get
(
'processingTime'
,
None
)
if
processingTime
:
if
processingTime
:
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
remainingProcessingTime
=
RPT
entity
.
remainingProcessingTime
=
RPT
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
remainingProcessingTime
,
reverse
=
True
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
remainingProcessingTime
,
reverse
=
True
)
#if the schedulingRule is to sort Entities according to longest processing time first in the next station
#if the schedulingRule is to sort Entities according to longest processing time first in the next station
# TODO: have to compare the entitiesToGet
elif
criterion
==
"LPT"
:
elif
criterion
==
"LPT"
:
for
entity
in
activeObjectQ
:
for
object
in
activeObjectQ
:
entity
=
object
.
entityToGet
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
if
processingTime
:
if
processingTime
:
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
else
:
else
:
entity
.
processingTimeInNextStation
=
0
entity
.
processingTimeInNextStation
=
0
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
processingTimeInNextStation
,
reverse
=
True
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
processingTimeInNextStation
,
reverse
=
True
)
#if the schedulingRule is to sort Entities according to shortest processing time first in the next station
#if the schedulingRule is to sort Entities according to shortest processing time first in the next station
# TODO: have to compare the entitiesToGet
elif
criterion
==
"SPT"
:
elif
criterion
==
"SPT"
:
for
entity
in
activeObjectQ
:
for
object
in
activeObjectQ
:
entity
=
object
.
entityToGet
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
processingTime
=
entity
.
remainingRoute
[
0
].
get
(
'processingTime'
,
None
)
if
processingTime
:
if
processingTime
:
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
processingTimeInNextStation
=
float
(
processingTime
.
get
(
'mean'
,
0
))
else
:
else
:
entity
.
processingTimeInNextStation
=
0
entity
.
processingTimeInNextStation
=
0
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
processingTimeInNextStation
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
processingTimeInNextStation
)
#if the schedulingRule is to sort Entities based on the minimum slackness
#if the schedulingRule is to sort Entities based on the minimum slackness
# TODO: have to compare the entitiesToGet
elif
criterion
==
"MS"
:
elif
criterion
==
"MS"
:
for
entity
in
activeObjectQ
:
for
object
in
activeObjectQ
:
object
.
entityToGet
RPT
=
0
RPT
=
0
for
step
in
entity
.
remainingRoute
:
for
step
in
entity
.
remainingRoute
:
processingTime
=
step
.
get
(
'processingTime'
,
None
)
processingTime
=
step
.
get
(
'processingTime'
,
None
)
if
processingTime
:
if
processingTime
:
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
RPT
+=
float
(
processingTime
.
get
(
'mean'
,
0
))
entity
.
remainingProcessingTime
=
RPT
entity
.
remainingProcessingTime
=
RPT
activeObjectQ
.
sort
(
key
=
lambda
x
:
(
x
.
dueDate
-
x
.
remainingProcessingTime
))
activeObjectQ
.
sort
(
key
=
lambda
x
:
(
x
.
entityToGet
.
dueDate
-
x
.
entityToGet
.
remainingProcessingTime
))
#if the schedulingRule is to sort Entities based on the length of the following Queue
#if the schedulingRule is to sort Entities based on the length of the following Queue
# TODO: have to compare the entitiesToGet
elif
criterion
==
"WINQ"
:
elif
criterion
==
"WINQ"
:
from
Globals
import
G
from
Globals
import
G
for
entity
in
activeObjectQ
:
for
object
in
activeObjectQ
:
entity
=
object
.
entityToGet
nextObjIds
=
entity
.
remainingRoute
[
1
].
get
(
'stationIdsList'
,[])
nextObjIds
=
entity
.
remainingRoute
[
1
].
get
(
'stationIdsList'
,[])
for
obj
in
G
.
ObjList
:
for
obj
in
G
.
ObjList
:
if
obj
.
id
in
nextObjIds
:
if
obj
.
id
in
nextObjIds
:
nextObject
=
obj
nextObject
=
obj
entity
.
nextQueueLength
=
len
(
nextObject
.
getActiveObjectQueue
())
entity
.
nextQueueLength
=
len
(
nextObject
.
getActiveObjectQueue
())
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
nextQueueLength
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
nextQueueLength
)
else
:
else
:
assert
False
,
"Unknown scheduling criterion %r"
%
(
criterion
,
)
assert
False
,
"Unknown scheduling criterion %r"
%
(
criterion
,
)
...
...
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