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
5beb1e5c
Commit
5beb1e5c
authored
Sep 17, 2014
by
Ioannis Papagiannopoulos
Committed by
Jérome Perrin
Feb 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router minor-cleanup
parent
3ccefa64
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
116 deletions
+120
-116
dream/simulation/Machine.py
dream/simulation/Machine.py
+11
-11
dream/simulation/Operator.py
dream/simulation/Operator.py
+7
-3
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+99
-102
dream/simulation/OperatorRouterManaged.py
dream/simulation/OperatorRouterManaged.py
+3
-0
No files found.
dream/simulation/Machine.py
View file @
5beb1e5c
...
...
@@ -1111,17 +1111,17 @@ class Machine(CoreObject):
return
self
.
loadRng
.
generateNumber
()
#===========================================================================
# find candidate operators within the free operators
#===========================================================================
def
findCandidateOperator
(
self
):
# TODO: this way no sorting is performed
# find an available operator
candidateOperator
=
self
.
operatorPool
.
findAvailableOperator
()
# append the station into its candidateStations
if
candidateOperator
:
# if there was an operator found append the Machine on his candidateStations
candidateOperator
.
candidateStations
.
append
(
self
)
return
candidateOperator
#
#===========================================================================
#
# find candidate operators within the free operators
#
#===========================================================================
#
def findCandidateOperator(self):
#
# TODO: this way no sorting is performed
#
# find an available operator
#
candidateOperator=self.operatorPool.findAvailableOperator()
#
# append the station into its candidateStations
#
if candidateOperator: # if there was an operator found append the Machine on his candidateStations
#
candidateOperator.candidateStations.append(self)
#
return candidateOperator
#===========================================================================
# checks whether the entity can proceed to a successor object
...
...
dream/simulation/Operator.py
View file @
5beb1e5c
...
...
@@ -202,12 +202,16 @@ class Operator(ObjectResource):
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
broker
.
timeWaitForOperatorStarted
else
:
machine
.
timeWaiting
=
self
.
env
.
now
-
machine
.
timeLastEntityLeft
# find the stations that hold
critical entities
# find the stations that hold
or are about to be delivered critical entities
if
self
in
router
.
preemptiveOperators
:
for
entity
in
station
.
getActiveObjectQueue
():
if
entity
.
isCritical
:
for
entity
in
machine
.
getActiveObjectQueue
():
if
entity
in
router
.
pending
and
entity
.
isCritical
:
machine
.
critical
=
True
break
for
previous
in
machine
.
previous
:
for
entity
in
previous
.
getActiveObjectQueue
():
if
entity
in
router
.
pending
and
entity
.
isCritical
:
machine
.
critical
=
True
# sort the stations according their timeWaiting
self
.
candidateStations
.
sort
(
key
=
lambda
x
:
x
.
timeWaiting
,
reverse
=
True
)
# sort the stations if they hold critical entities
...
...
dream/simulation/OperatorRouter.py
View file @
5beb1e5c
This diff is collapsed.
Click to expand it.
dream/simulation/OperatorRouterManaged.py
View file @
5beb1e5c
...
...
@@ -52,6 +52,7 @@ class RouterManaged(Router):
self
.
schedulingRule
=
'WT'
# boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
self
.
sorting
=
sorting
self
.
entitiesWithOccupiedReceivers
=
[]
# list of entities that have no available receivers
#===========================================================================
# the initialize method
...
...
@@ -67,6 +68,7 @@ class RouterManaged(Router):
self
.
multipleCriterionList
=
[]
# TODO: find out which must be the default for the scheduling Rule
self
.
schedulingRule
=
'WT'
self
.
entitiesWithOccupiedReceivers
=
[]
# =======================================================================
# the run method
...
...
@@ -248,6 +250,7 @@ class RouterManaged(Router):
def
findPendingEntities
(
self
):
from
Globals
import
G
self
.
pending
=
[]
# list of entities that are pending
self
.
criticalPending
=
[]
for
machine
in
self
.
pendingMachines
:
self
.
pending
.
append
(
machine
.
currentEntity
)
for
entity
in
G
.
pendingEntities
:
...
...
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