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
81b991cd
Commit
81b991cd
authored
Sep 23, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further clean-up in Skilled/OperatorRouter/Managed
parent
23364a84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
59 deletions
+20
-59
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+4
-25
dream/simulation/OperatorRouterManaged.py
dream/simulation/OperatorRouterManaged.py
+12
-30
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+4
-4
No files found.
dream/simulation/OperatorRouter.py
View file @
81b991cd
...
...
@@ -49,16 +49,8 @@ class Router(ObjectInterruption):
self
.
toBeSignalled
=
[]
# flag to notify whether the router is already invoked
self
.
invoked
=
False
self
.
preemptiveOperators
=
[]
# list of preemptiveOperators that should preempt their machines
self
.
conflictingOperators
=
[]
# list with the operators that have candidateEntity with conflicting candidateReceivers
self
.
conflictingEntities
=
[]
# entities with conflictingReceivers
self
.
conflictingStations
=
[]
# stations with conflicting operators
self
.
occupiedReceivers
=
[]
# occupied candidateReceivers of a candidateEntity
self
.
criticalQueues
=
[]
self
.
pending
=
[]
# list of entities that require operators now
#===========================================================================
...
...
@@ -75,19 +67,10 @@ class Router(ObjectInterruption):
self
.
candidateOperators
=
[]
# flag used to check if the Router is initialised
self
.
isInitialized
=
True
self
.
invoked
=
False
self
.
preemptiveOperators
=
[]
self
.
toBeSignalled
=
[]
self
.
conflictingOperators
=
[]
self
.
conflictingEntities
=
[]
self
.
conflictingStations
=
[]
self
.
occupiedReceivers
=
[]
self
.
criticalQueues
=
[]
self
.
pending
=
[]
# list of entities that require operators now
# =======================================================================
...
...
@@ -118,7 +101,7 @@ class Router(ObjectInterruption):
break
self
.
printTrace
(
''
,
'=-'
*
15
)
# entry actions
self
.
entry
()
self
.
entry
Actions
()
# run the routine that allocates operators to machines
self
.
allocateOperators
()
# assign operators to stations
...
...
@@ -130,7 +113,7 @@ class Router(ObjectInterruption):
self
.
printTrace
(
''
,
'router exiting'
)
self
.
printTrace
(
''
,
'=-'
*
20
)
# exit actions
self
.
exit
()
self
.
exit
Actions
()
#===========================================================================
# routing performed to define the candidate operators the pending entities and how the operators should be allocated
...
...
@@ -190,7 +173,7 @@ class Router(ObjectInterruption):
#===========================================================================
# entry actions
#===========================================================================
def
entry
(
self
):
def
entry
Actions
(
self
):
from
Globals
import
G
for
operator
in
G
.
OperatorsList
:
operator
.
candidateEntity
=
None
...
...
@@ -198,7 +181,7 @@ class Router(ObjectInterruption):
# =======================================================================
# return control to the Machine.run
# =======================================================================
def
exit
(
self
):
def
exit
Actions
(
self
):
from
Globals
import
G
# reset the variables that are used from the Router
for
operator
in
self
.
candidateOperators
:
...
...
@@ -214,10 +197,6 @@ class Router(ObjectInterruption):
del
self
.
pendingMachines
[:]
del
self
.
pendingQueues
[:]
del
self
.
toBeSignalled
[:]
del
self
.
conflictingOperators
[:]
del
self
.
conflictingStations
[:]
del
self
.
conflictingEntities
[:]
del
self
.
occupiedReceivers
[:]
del
self
.
criticalQueues
[:]
del
self
.
pending
[:]
self
.
invoked
=
False
...
...
dream/simulation/OperatorRouterManaged.py
View file @
81b991cd
...
...
@@ -43,13 +43,14 @@ class RouterManaged(Router):
# according to this implementation one machine per broker is allowed
# The Broker is initiated within the Machine and considered as
# black box for the ManPy end Developer
# TODO: we should maybe define a global schedulingRule criterion that will be
# chosen in case of multiple criteria for different Operators
# =======================================================================
def
__init__
(
self
):
Router
.
__init__
(
self
)
# boolean flag to check whether the Router should perform sorting on operators and on pendingEntities
self
.
entitiesWithOccupiedReceivers
=
[]
# list of entities that have no available receivers
self
.
conflictingEntities
=
[]
# entities with conflictingReceivers
self
.
conflictingOperators
=
[]
# list with the operators that have candidateEntity with conflicting candidateReceivers
self
.
occupiedReceivers
=
[]
# occupied candidateReceivers of a candidateEntity
#===========================================================================
# the initialize method
...
...
@@ -59,6 +60,9 @@ class RouterManaged(Router):
# list that holds all the objects that can receive
self
.
pendingObjects
=
[]
self
.
entitiesWithOccupiedReceivers
=
[]
self
.
conflictingEntities
=
[]
# entities with conflictingReceivers
self
.
conflictingOperators
=
[]
# list with the operators that have candidateEntity with conflicting candidateReceivers
self
.
occupiedReceivers
=
[]
# occupied candidateReceivers of a candidateEntity
# =======================================================================
# the run method
...
...
@@ -90,7 +94,7 @@ class RouterManaged(Router):
self
.
printTrace
(
''
,
'=-'
*
15
)
# entry actions
self
.
entry
()
self
.
entry
Actions
()
# run the routine that allocates operators to machines
self
.
allocateOperators
()
# assign operators to stations
...
...
@@ -102,9 +106,9 @@ class RouterManaged(Router):
self
.
printTrace
(
''
,
'router exiting'
)
self
.
printTrace
(
''
,
'=-'
*
20
)
# exit actions
self
.
exit
()
self
.
exit
Actions
()
def
entry
(
self
):
def
entry
Actions
(
self
):
pass
def
allocateOperators
(
self
):
...
...
@@ -134,32 +138,16 @@ class RouterManaged(Router):
# =======================================================================
# return control to the Machine.run
# =======================================================================
def
exit
(
self
):
from
Globals
import
G
# reset the variables that are used from the Router
def
exitActions
(
self
):
# reset the candidateEntities of the operators
for
operator
in
self
.
candidateOperators
:
operator
.
candidateEntities
=
[]
operator
.
candidateStations
=
[]
operator
.
candidateStation
=
None
operator
.
candidateEntity
=
None
for
entity
in
G
.
pendingEntities
:
entity
.
proceed
=
False
entity
.
candidateReceivers
=
[]
entity
.
candidateReceiver
=
None
del
self
.
candidateOperators
[:]
del
self
.
criticalPending
[:]
del
self
.
preemptiveOperators
[:]
del
self
.
pendingObjects
[:]
del
self
.
pendingMachines
[:]
del
self
.
pendingQueues
[:]
del
self
.
toBeSignalled
[:]
del
self
.
conflictingOperators
[:]
del
self
.
conflictingStations
[:]
del
self
.
conflictingEntities
[:]
del
self
.
occupiedReceivers
[:]
del
self
.
entitiesWithOccupiedReceivers
[:]
self
.
invoked
=
False
Router
.
exitActions
(
self
)
#===========================================================================
# assigning operators to machines
...
...
@@ -233,7 +221,6 @@ 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
:
...
...
@@ -241,13 +228,8 @@ class RouterManaged(Router):
for
machine
in
entity
.
currentStation
.
next
:
if
any
(
type
==
'Load'
for
type
in
machine
.
multOperationTypeList
):
self
.
pending
.
append
(
entity
)
# if the entity is critical add it to the criticalPending List
if
entity
.
isCritical
and
not
entity
in
self
.
criticalPending
:
self
.
criticalPending
.
append
(
entity
)
break
self
.
printTrace
(
'found pending entities'
+
'-'
*
12
+
'>'
,
[
str
(
entity
.
id
)
for
entity
in
self
.
pending
if
not
entity
.
type
==
'Part'
])
if
self
.
criticalPending
:
self
.
printTrace
(
'found pending critical'
+
'-'
*
12
+
'>'
,
[
str
(
entity
.
id
)
for
entity
in
self
.
criticalPending
if
not
entity
.
type
==
'Part'
])
#========================================================================
# Find candidate Operators
...
...
dream/simulation/SkilledOperatorRouter.py
View file @
81b991cd
...
...
@@ -268,7 +268,7 @@ class SkilledRouter(Router):
#===================================================================
else
:
# entry actions
self
.
entry
()
self
.
entry
Actions
()
# run the routine that allocates operators to machines
self
.
allocateOperators
()
# assign operators to stations
...
...
@@ -282,7 +282,7 @@ class SkilledRouter(Router):
self
.
previousSolution
=
solution
self
.
printTrace
(
''
,
'router exiting'
)
self
.
printTrace
(
''
,
'=-'
*
20
)
self
.
exit
()
self
.
exit
Actions
()
# =======================================================================
# signal the station or the Queue to impose the assignment
...
...
@@ -306,8 +306,8 @@ class SkilledRouter(Router):
# =======================================================================
# return control to the Machine.run
# =======================================================================
def
exit
(
self
):
Router
.
exit
(
self
)
def
exit
Actions
(
self
):
Router
.
exit
Actions
(
self
)
self
.
allocation
=
False
self
.
waitEndProcess
=
False
\ 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