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
ef7c769e
Commit
ef7c769e
authored
Mar 04, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction so that G.Router is eliminated
parent
3a38d684
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
53 additions
and
57 deletions
+53
-57
dream/simulation/BatchReassembly.py
dream/simulation/BatchReassembly.py
+1
-1
dream/simulation/Exit.py
dream/simulation/Exit.py
+1
-1
dream/simulation/Globals.py
dream/simulation/Globals.py
+1
-4
dream/simulation/Job.py
dream/simulation/Job.py
+1
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+4
-5
dream/simulation/Machine.py
dream/simulation/Machine.py
+16
-16
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+3
-3
dream/simulation/ManPyObject.py
dream/simulation/ManPyObject.py
+10
-10
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+7
-7
dream/simulation/Operator.py
dream/simulation/Operator.py
+1
-1
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+2
-2
dream/simulation/QueueManagedJob.py
dream/simulation/QueueManagedJob.py
+4
-4
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+1
-1
dream/simulation/Source.py
dream/simulation/Source.py
+1
-1
No files found.
dream/simulation/BatchReassembly.py
View file @
ef7c769e
...
@@ -238,7 +238,7 @@ class BatchReassembly(CoreObject):
...
@@ -238,7 +238,7 @@ class BatchReassembly(CoreObject):
# if the activeEntity is in the pendingEntities list then place the subBatches there
# if the activeEntity is in the pendingEntities list then place the subBatches there
if
activeObjectQueue
[
0
]
in
G
.
pendingEntities
:
if
activeObjectQueue
[
0
]
in
G
.
pendingEntities
:
G
.
pendingEntities
.
append
(
batchToBeReassembled
)
G
.
pendingEntities
.
append
(
batchToBeReassembled
)
if
G
.
Router
:
if
G
.
Router
List
:
for
entity
in
activeObjectQueue
:
for
entity
in
activeObjectQueue
:
G
.
pendingEntities
.
remove
(
entity
)
G
.
pendingEntities
.
remove
(
entity
)
...
...
dream/simulation/Exit.py
View file @
ef7c769e
...
@@ -108,7 +108,7 @@ class Exit(CoreObject):
...
@@ -108,7 +108,7 @@ class Exit(CoreObject):
# if the entity is in the G.pendingEntities list then remove it from there
# if the entity is in the G.pendingEntities list then remove it from there
from
Globals
import
G
from
Globals
import
G
# G.pendingEntities[:]=(entity for entity in G.pendingEntities if not entity is activeEntity)
# G.pendingEntities[:]=(entity for entity in G.pendingEntities if not entity is activeEntity)
if
G
.
Router
:
if
G
.
Router
List
:
if
activeEntity
in
G
.
pendingEntities
:
if
activeEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
activeEntity
)
G
.
pendingEntities
.
remove
(
activeEntity
)
# if activeEntity in G.EntityList:
# if activeEntity in G.EntityList:
...
...
dream/simulation/Globals.py
View file @
ef7c769e
...
@@ -76,10 +76,7 @@ class G:
...
@@ -76,10 +76,7 @@ class G:
outputJSONFile
=
None
outputJSONFile
=
None
numberOfEntities
=
0
numberOfEntities
=
0
#object that routes the operators in the model
Router
=
None
# define the lists of each object type
# define the lists of each object type
SourceList
=
[]
SourceList
=
[]
MachineList
=
[]
MachineList
=
[]
...
...
dream/simulation/Job.py
View file @
ef7c769e
...
@@ -295,7 +295,7 @@ class Job(Entity): # inherits from the Entity c
...
@@ -295,7 +295,7 @@ class Job(Entity): # inherits from the Entity c
#===========================================================================
#===========================================================================
def
findCandidateReceiver
(
self
):
def
findCandidateReceiver
(
self
):
from
Globals
import
G
from
Globals
import
G
router
=
G
.
Router
router
=
G
.
Router
List
[
0
]
# initiate the local list variable available receivers
# initiate the local list variable available receivers
availableReceivers
=
[
x
for
x
in
self
.
candidateReceivers
\
availableReceivers
=
[
x
for
x
in
self
.
candidateReceivers
\
if
not
x
in
router
.
occupiedReceivers
]
if
not
x
in
router
.
occupiedReceivers
]
...
...
dream/simulation/LineGenerationJSON.py
View file @
ef7c769e
...
@@ -124,7 +124,6 @@ def createObjectResourcesAndCoreObjects():
...
@@ -124,7 +124,6 @@ def createObjectResourcesAndCoreObjects():
G
.
OperatorManagedJobsList
=
[]
G
.
OperatorManagedJobsList
=
[]
G
.
OperatorPoolsList
=
[]
G
.
OperatorPoolsList
=
[]
G
.
BrokersList
=
[]
G
.
BrokersList
=
[]
G
.
Router
=
None
G
.
OperatedMachineList
=
[]
G
.
OperatedMachineList
=
[]
G
.
BatchScrapMachineList
=
[]
G
.
BatchScrapMachineList
=
[]
G
.
OrderDecompositionList
=
[]
G
.
OrderDecompositionList
=
[]
...
@@ -592,6 +591,7 @@ def main(argv=[], input_data=None):
...
@@ -592,6 +591,7 @@ def main(argv=[], input_data=None):
#create an empty list to store all the objects in
#create an empty list to store all the objects in
G
.
ObjList
=
[]
G
.
ObjList
=
[]
G
.
RouterList
=
[]
if
input_data
is
None
:
if
input_data
is
None
:
# user passes the topology filename as first argument to the program
# user passes the topology filename as first argument to the program
...
@@ -618,9 +618,9 @@ def main(argv=[], input_data=None):
...
@@ -618,9 +618,9 @@ def main(argv=[], input_data=None):
G
.
env
=
simpy
.
Environment
()
# initialize the environment
G
.
env
=
simpy
.
Environment
()
# initialize the environment
G
.
maxSimTime
=
float
(
G
.
JSONData
[
'general'
].
get
(
'maxSimTime'
,
'100'
))
# read the maxSimTime in each replication
G
.
maxSimTime
=
float
(
G
.
JSONData
[
'general'
].
get
(
'maxSimTime'
,
'100'
))
# read the maxSimTime in each replication
# since it may be changed for infinite ones
# since it may be changed for infinite ones
if
G
.
Router
:
if
G
.
Router
List
:
G
.
Router
.
isActivated
=
False
G
.
Router
List
[
0
]
.
isActivated
=
False
G
.
Router
.
isInitialized
=
False
G
.
Router
List
[
0
]
.
isInitialized
=
False
if
G
.
seed
:
if
G
.
seed
:
G
.
Rnd
=
Random
(
'%s%s'
%
(
G
.
seed
,
i
))
G
.
Rnd
=
Random
(
'%s%s'
%
(
G
.
seed
,
i
))
...
@@ -695,7 +695,6 @@ def main(argv=[], input_data=None):
...
@@ -695,7 +695,6 @@ def main(argv=[], input_data=None):
if
0
:
if
0
:
G
.
outputJSONFile
=
open
(
'outputJSON.json'
,
mode
=
'w'
)
G
.
outputJSONFile
=
open
(
'outputJSON.json'
,
mode
=
'w'
)
G
.
outputJSONFile
.
write
(
outputJSONString
)
G
.
outputJSONFile
.
write
(
outputJSONString
)
if
not
input_data
:
if
not
input_data
:
# Output on stdout
# Output on stdout
print
outputJSONString
print
outputJSONString
...
...
dream/simulation/Machine.py
View file @
ef7c769e
...
@@ -257,16 +257,16 @@ class Machine(CoreObject):
...
@@ -257,16 +257,16 @@ class Machine(CoreObject):
if
(
self
.
operatorPool
!=
'None'
):
if
(
self
.
operatorPool
!=
'None'
):
from
Globals
import
G
from
Globals
import
G
# if there is no router
# if there is no router
if
not
G
.
Router
:
if
not
G
.
Router
List
:
# TODO if the dedicatedOperator flag is raised then create a SkilledRouter (temp)
# TODO if the dedicatedOperator flag is raised then create a SkilledRouter (temp)
if
self
.
dedicatedOperator
:
if
self
.
dedicatedOperator
:
self
.
router
=
SkilledRouter
()
self
.
router
=
SkilledRouter
()
else
:
else
:
self
.
router
=
Router
()
self
.
router
=
Router
()
G
.
Router
=
self
.
router
G
.
Router
List
[
0
]
=
self
.
router
# otherwise set the already existing router as the machines Router
# otherwise set the already existing router as the machines Router
else
:
else
:
self
.
router
=
G
.
Router
self
.
router
=
G
.
Router
List
[
0
]
#===========================================================================
#===========================================================================
# initialise broker if needed
# initialise broker if needed
#===========================================================================
#===========================================================================
...
@@ -507,7 +507,7 @@ class Machine(CoreObject):
...
@@ -507,7 +507,7 @@ class Machine(CoreObject):
yield
self
.
env
.
process
(
self
.
release
())
yield
self
.
env
.
process
(
self
.
release
())
from
Globals
import
G
from
Globals
import
G
# append the entity that was stopped to the pending ones
# append the entity that was stopped to the pending ones
if
G
.
Router
:
if
G
.
Router
List
:
G
.
pendingEntities
.
append
(
self
.
currentEntity
)
G
.
pendingEntities
.
append
(
self
.
currentEntity
)
#===========================================================
#===========================================================
# # request a resource after the interruption
# # request a resource after the interruption
...
@@ -581,8 +581,8 @@ class Machine(CoreObject):
...
@@ -581,8 +581,8 @@ class Machine(CoreObject):
if
self
.
signalGiver
():
if
self
.
signalGiver
():
# XXX cleaner implementation needed
# XXX cleaner implementation needed
# if there is skilled router the giver should also check
# if there is skilled router the giver should also check
if
G
.
Router
:
if
G
.
Router
List
:
if
'Skilled'
in
str
(
G
.
Router
.
__class__
):
if
'Skilled'
in
str
(
G
.
Router
List
[
0
]
.
__class__
):
continue
continue
break
break
if
self
.
loadOperatorAvailable
in
receivedEvent
:
if
self
.
loadOperatorAvailable
in
receivedEvent
:
...
@@ -594,8 +594,8 @@ class Machine(CoreObject):
...
@@ -594,8 +594,8 @@ class Machine(CoreObject):
if
self
.
signalGiver
():
if
self
.
signalGiver
():
# XXX cleaner implementation needed
# XXX cleaner implementation needed
# if there is router that is not skilled break
# if there is router that is not skilled break
if
G
.
Router
:
if
G
.
Router
List
:
if
not
'Skilled'
in
str
(
G
.
Router
.
__class__
):
if
not
'Skilled'
in
str
(
G
.
Router
List
[
0
]
.
__class__
):
break
break
# else continue, the giver should also check
# else continue, the giver should also check
continue
continue
...
@@ -889,7 +889,7 @@ class Machine(CoreObject):
...
@@ -889,7 +889,7 @@ class Machine(CoreObject):
except
IndexError
:
except
IndexError
:
pass
pass
from
Globals
import
G
from
Globals
import
G
if
G
.
Router
:
if
G
.
Router
List
:
# the just processed entity is added to the list of entities
# the just processed entity is added to the list of entities
# pending for the next processing
# pending for the next processing
G
.
pendingEntities
.
append
(
activeObjectQueue
[
0
])
G
.
pendingEntities
.
append
(
activeObjectQueue
[
0
])
...
@@ -1095,7 +1095,7 @@ class Machine(CoreObject):
...
@@ -1095,7 +1095,7 @@ class Machine(CoreObject):
activeEntity
=
CoreObject
.
getEntity
(
self
)
# run the default method
activeEntity
=
CoreObject
.
getEntity
(
self
)
# run the default method
# after the machine receives an entity, it must be removed from the pendingEntities list
# after the machine receives an entity, it must be removed from the pendingEntities list
from
Globals
import
G
from
Globals
import
G
if
G
.
Router
:
if
G
.
Router
List
:
if
activeEntity
in
G
.
pendingEntities
:
if
activeEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
activeEntity
)
G
.
pendingEntities
.
remove
(
activeEntity
)
return
activeEntity
return
activeEntity
...
@@ -1141,7 +1141,7 @@ class Machine(CoreObject):
...
@@ -1141,7 +1141,7 @@ class Machine(CoreObject):
activeEntity
=
entity
activeEntity
=
entity
from
Globals
import
G
from
Globals
import
G
router
=
G
.
Router
router
=
G
.
Router
List
[
0
]
# if the entity is in a machines who's broker waits for operator then
# if the entity is in a machines who's broker waits for operator then
if
self
in
router
.
pendingMachines
:
if
self
in
router
.
pendingMachines
:
activeEntity
.
proceed
=
True
activeEntity
.
proceed
=
True
...
@@ -1177,11 +1177,11 @@ class Machine(CoreObject):
...
@@ -1177,11 +1177,11 @@ class Machine(CoreObject):
# if the Router is expecting for signal send it
# if the Router is expecting for signal send it
from
Globals
import
G
from
Globals
import
G
from
SkilledOperatorRouter
import
SkilledRouter
from
SkilledOperatorRouter
import
SkilledRouter
if
G
.
Router
.
__class__
is
SkilledRouter
:
if
G
.
Router
List
[
0
]
.
__class__
is
SkilledRouter
:
if
G
.
Router
.
expectedFinishSignals
:
if
G
.
Router
List
[
0
]
.
expectedFinishSignals
:
if
self
.
id
in
G
.
Router
.
expectedFinishSignalsDict
:
if
self
.
id
in
G
.
Router
List
[
0
]
.
expectedFinishSignalsDict
:
signal
=
G
.
Router
.
expectedFinishSignalsDict
[
self
.
id
]
signal
=
G
.
Router
List
[
0
]
.
expectedFinishSignalsDict
[
self
.
id
]
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
signal
)
self
.
sendSignal
(
receiver
=
G
.
Router
List
[
0
]
,
signal
=
signal
)
self
.
broker
.
invoke
()
self
.
broker
.
invoke
()
self
.
toBeOperated
=
False
self
.
toBeOperated
=
False
...
...
dream/simulation/MachineManagedJob.py
View file @
ef7c769e
...
@@ -66,12 +66,12 @@ class MachineManagedJob(MachineJobShop):
...
@@ -66,12 +66,12 @@ class MachineManagedJob(MachineJobShop):
def
createRouter
(
self
):
def
createRouter
(
self
):
#create a Router
#create a Router
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
:
if
not
G
.
Router
List
:
self
.
router
=
RouterManaged
()
self
.
router
=
RouterManaged
()
G
.
Router
=
self
.
router
G
.
Router
List
[
0
]
=
self
.
router
# otherwise set the already existing router as the machines Router
# otherwise set the already existing router as the machines Router
else
:
else
:
self
.
router
=
G
.
Router
self
.
router
=
G
.
Router
List
[
0
]
#===========================================================================
#===========================================================================
# initialize broker if needed
# initialize broker if needed
...
...
dream/simulation/ManPyObject.py
View file @
ef7c769e
...
@@ -53,13 +53,13 @@ class ManPyObject(object):
...
@@ -53,13 +53,13 @@ class ManPyObject(object):
def
requestAllocation
():
def
requestAllocation
():
# TODO: signal the Router, skilled operators must be assigned to operatorPools
# TODO: signal the Router, skilled operators must be assigned to operatorPools
from
Globals
import
G
from
Globals
import
G
G
.
Router
.
allocation
=
True
G
.
Router
List
[
0
]
.
allocation
=
True
G
.
Router
.
waitEndProcess
=
False
G
.
Router
List
[
0
]
.
waitEndProcess
=
False
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
expectedSignals
[
'isCalled'
]:
G
.
Router
.
invoked
=
True
G
.
Router
List
[
0
]
.
invoked
=
True
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
List
[
0
]
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
G
.
Router
List
[
0
]
.
expectedSignals
[
'isCalled'
]
=
0
#===========================================================================
#===========================================================================
# signalRouter method
# signalRouter method
...
@@ -74,12 +74,12 @@ class ManPyObject(object):
...
@@ -74,12 +74,12 @@ class ManPyObject(object):
if
receiver
.
isLoadRequested
():
if
receiver
.
isLoadRequested
():
try
:
try
:
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
expectedSignals
[
'isCalled'
]:
# self.printTrace(self.id, signal='router')
# self.printTrace(self.id, signal='router')
G
.
Router
.
invoked
=
True
G
.
Router
List
[
0
]
.
invoked
=
True
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
List
[
0
]
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
G
.
Router
List
[
0
]
.
expectedSignals
[
'isCalled'
]
=
0
return
True
return
True
except
:
except
:
return
False
return
False
...
...
dream/simulation/OperatedPoolBroker.py
View file @
ef7c769e
...
@@ -96,10 +96,10 @@ class Broker(ObjectInterruption):
...
@@ -96,10 +96,10 @@ class Broker(ObjectInterruption):
# add the currentEntity to the pendingEntities
# add the currentEntity to the pendingEntities
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
self
.
sendSignal
(
receiver
=
G
.
Router
List
[
0
],
signal
=
G
.
RouterList
[
0
]
.
isCalled
)
G
.
Router
.
invoked
=
True
G
.
Router
List
[
0
]
.
invoked
=
True
self
.
waitForOperator
=
True
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
...
@@ -118,7 +118,7 @@ class Broker(ObjectInterruption):
...
@@ -118,7 +118,7 @@ class Broker(ObjectInterruption):
# else if the Router is already invoked for allocating purposes wait until a resource is allocated to the victim's operatorPool
# else if the Router is already invoked for allocating purposes wait until a resource is allocated to the victim's operatorPool
# wait only if there is no current operator
# wait only if there is no current operator
# XXX discuss this
# XXX discuss this
elif
G
.
Router
.
invoked
and
G
.
Router
.
allocation
and
not
self
.
victim
.
currentOperator
:
elif
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
allocation
and
not
self
.
victim
.
currentOperator
:
self
.
waitForOperator
=
True
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
...
@@ -178,10 +178,10 @@ class Broker(ObjectInterruption):
...
@@ -178,10 +178,10 @@ class Broker(ObjectInterruption):
# TODO: signalling the router must be done more elegantly, router must be set as global variable
# TODO: signalling the router must be done more elegantly, router must be set as global variable
# if the router is already invoked then do not signal it again
# if the router is already invoked then do not signal it again
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
G
.
Router
.
invoked
=
True
G
.
Router
List
[
0
]
.
invoked
=
True
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
self
.
sendSignal
(
receiver
=
G
.
Router
List
[
0
],
signal
=
G
.
RouterList
[
0
]
.
isCalled
)
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# after signalling the broker will signal it's victim that it has finished it's processes
# after signalling the broker will signal it's victim that it has finished it's processes
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
...
...
dream/simulation/Operator.py
View file @
ef7c769e
...
@@ -128,7 +128,7 @@ class Operator(ObjectResource):
...
@@ -128,7 +128,7 @@ class Operator(ObjectResource):
#===========================================================================
#===========================================================================
def
sortStations
(
self
):
def
sortStations
(
self
):
from
Globals
import
G
from
Globals
import
G
router
=
G
.
Router
router
=
G
.
Router
List
[
0
]
candidateMachines
=
self
.
candidateStations
candidateMachines
=
self
.
candidateStations
# for the candidateMachines
# for the candidateMachines
if
candidateMachines
:
if
candidateMachines
:
...
...
dream/simulation/OperatorManagedJob.py
View file @
ef7c769e
...
@@ -84,7 +84,7 @@ class OperatorManagedJob(Operator):
...
@@ -84,7 +84,7 @@ class OperatorManagedJob(Operator):
#===========================================================================
#===========================================================================
def
findAvailableEntity
(
self
):
def
findAvailableEntity
(
self
):
from
Globals
import
G
from
Globals
import
G
router
=
G
.
Router
router
=
G
.
Router
List
[
0
]
# if the candidateEntities and the entitiesWithOccupiedReceivers lists are identical then return None
# if the candidateEntities and the entitiesWithOccupiedReceivers lists are identical then return None
if
len
(
set
(
self
.
candidateEntities
).
intersection
(
router
.
entitiesWithOccupiedReceivers
))
==
len
(
self
.
candidateEntities
):
if
len
(
set
(
self
.
candidateEntities
).
intersection
(
router
.
entitiesWithOccupiedReceivers
))
==
len
(
self
.
candidateEntities
):
return
None
return
None
...
@@ -106,7 +106,7 @@ class OperatorManagedJob(Operator):
...
@@ -106,7 +106,7 @@ class OperatorManagedJob(Operator):
#===========================================================================
#===========================================================================
def
findCandidateEntity
(
self
):
def
findCandidateEntity
(
self
):
from
Globals
import
G
from
Globals
import
G
router
=
G
.
Router
router
=
G
.
Router
List
[
0
]
# pick a candidateEntity
# pick a candidateEntity
candidateEntity
=
self
.
findAvailableEntity
()
candidateEntity
=
self
.
findAvailableEntity
()
if
not
candidateEntity
:
if
not
candidateEntity
:
...
...
dream/simulation/QueueManagedJob.py
View file @
ef7c769e
...
@@ -105,12 +105,12 @@ class QueueManagedJob(QueueJobShop):
...
@@ -105,12 +105,12 @@ class QueueManagedJob(QueueJobShop):
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
if
receiver
.
identifyEntityToGet
().
manager
.
isAssignedTo
()
!=
receiver
:
try
:
try
:
from
Globals
import
G
from
Globals
import
G
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
List
[
0
].
invoked
and
G
.
RouterList
[
0
]
.
expectedSignals
[
'isCalled'
]:
# self.printTrace(self.id, signal='router')
# self.printTrace(self.id, signal='router')
G
.
Router
.
invoked
=
True
G
.
Router
List
[
0
]
.
invoked
=
True
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
succeedTuple
=
(
G
.
env
,
G
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
List
[
0
]
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
G
.
Router
List
[
0
]
.
expectedSignals
[
'isCalled'
]
=
0
return
True
return
True
except
:
except
:
return
False
return
False
...
...
dream/simulation/SkilledOperatorRouter.py
View file @
ef7c769e
...
@@ -42,7 +42,7 @@ class SkilledRouter(Router):
...
@@ -42,7 +42,7 @@ class SkilledRouter(Router):
# TODO: we should maybe define a global schedulingRule criterion that will be
# TODO: we should maybe define a global schedulingRule criterion that will be
# chosen in case of multiple criteria for different Operators
# chosen in case of multiple criteria for different Operators
# =======================================================================
# =======================================================================
def
__init__
(
self
,
sorting
=
False
,
outputSolutions
=
Fals
e
):
def
__init__
(
self
,
sorting
=
False
,
outputSolutions
=
Tru
e
):
Router
.
__init__
(
self
)
Router
.
__init__
(
self
)
# Flag used to notify the need for re-allocation of skilled operators to operatorPools
# Flag used to notify the need for re-allocation of skilled operators to operatorPools
self
.
allocation
=
False
self
.
allocation
=
False
...
...
dream/simulation/Source.py
View file @
ef7c769e
...
@@ -167,7 +167,7 @@ class Source(CoreObject):
...
@@ -167,7 +167,7 @@ class Source(CoreObject):
from
Globals
import
G
from
Globals
import
G
assert
entity
,
'cannot append None entity'
assert
entity
,
'cannot append None entity'
activeEntity
=
entity
activeEntity
=
entity
if
G
.
Router
:
if
G
.
Router
List
:
# at the newly created entity to the pendingEntities
# at the newly created entity to the pendingEntities
G
.
pendingEntities
.
append
(
activeEntity
)
G
.
pendingEntities
.
append
(
activeEntity
)
...
...
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