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
9cc2af6d
Commit
9cc2af6d
authored
May 20, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Operator sorts also according to preemption needs
parent
847c8a4c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+0
-4
dream/simulation/Operator.py
dream/simulation/Operator.py
+13
-1
No files found.
dream/simulation/MachineManagedJob.py
View file @
9cc2af6d
...
@@ -132,10 +132,6 @@ class MachineManagedJob(MachineJobShop):
...
@@ -132,10 +132,6 @@ class MachineManagedJob(MachineJobShop):
giverObject
.
assignExitTo
(
activeObject
)
giverObject
.
assignExitTo
(
activeObject
)
elif
giverObject
.
exitIsAssignedTo
()
!=
activeObject
:
elif
giverObject
.
exitIsAssignedTo
()
!=
activeObject
:
return
False
return
False
# if the activeObject is not in manager's activeCallersList of the entityToGet
if
activeObject
not
in
giverObjectQueue
[
0
].
manager
.
activeCallersList
:
# append it to the activeCallerList of the manager of the entity to be received
giverObjectQueue
[
0
].
manager
.
activeCallersList
.
append
(
self
)
# update entityToGet
# update entityToGet
activeObject
.
entityToGet
=
giverObjectQueue
[
0
]
activeObject
.
entityToGet
=
giverObjectQueue
[
0
]
#make the operators List so that it holds only the manager of the current order
#make the operators List so that it holds only the manager of the current order
...
...
dream/simulation/Operator.py
View file @
9cc2af6d
...
@@ -49,7 +49,7 @@ class Operator(ObjectResource):
...
@@ -49,7 +49,7 @@ class Operator(ObjectResource):
self
.
Working
=
[]
# holds the percentage of working time
self
.
Working
=
[]
# holds the percentage of working time
# the following attributes are not used by the Repairman
# the following attributes are not used by the Repairman
self
.
activeCallersList
=
[]
# the list of object that request the operator
#
self.activeCallersList=[] # the list of object that request the operator
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
self
.
multipleCriterionList
=
[]
#list with the criteria used to sort the Entities in the Queue
SRlist
=
[
schedulingRule
]
SRlist
=
[
schedulingRule
]
...
@@ -164,16 +164,28 @@ class Operator(ObjectResource):
...
@@ -164,16 +164,28 @@ class Operator(ObjectResource):
# now picks the machine that waits the most
# now picks the machine that waits the most
# =======================================================================
# =======================================================================
def
sortCandidateEntities
(
self
):
def
sortCandidateEntities
(
self
):
from
Globals
import
G
router
=
G
.
Router
candidateMachines
=
self
.
candidateStations
candidateMachines
=
self
.
candidateStations
# for the candidateMachines
# for the candidateMachines
if
candidateMachines
:
if
candidateMachines
:
# choose the one that waits the most time and give it the chance to grasp the resource
# choose the one that waits the most time and give it the chance to grasp the resource
for
machine
in
candidateMachines
:
for
machine
in
candidateMachines
:
machine
.
critical
=
False
if
machine
.
broker
.
waitForOperator
:
if
machine
.
broker
.
waitForOperator
:
machine
.
timeWaiting
=
now
()
-
machine
.
broker
.
timeWaitForOperatorStarted
machine
.
timeWaiting
=
now
()
-
machine
.
broker
.
timeWaitForOperatorStarted
else
:
else
:
machine
.
timeWaiting
=
now
()
-
machine
.
timeLastEntityLeft
machine
.
timeWaiting
=
now
()
-
machine
.
timeLastEntityLeft
# find the stations that hold critical entities
if
self
in
router
.
preemptiveOperators
:
for
entity
in
station
.
getActiveObjectQueue
():
if
entity
.
isCritical
:
machine
.
critical
=
True
break
# sort the stations according their timeWaiting
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
timeWaiting
,
reverse
=
True
)
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
timeWaiting
,
reverse
=
True
)
# sort the stations if they hold critical entities
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
critical
,
reverse
=
False
)
# # TODO: have to consider what happens in case of a critical order
# # TODO: have to consider what happens in case of a critical order
# #if we have sorting according to multiple criteria we have to call the sorter many times
# #if we have sorting according to multiple criteria we have to call the sorter many times
# if self.schedulingRule=="MC":
# if self.schedulingRule=="MC":
...
...
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