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
3a38d684
Commit
3a38d684
authored
Mar 04, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Routers to be able to output results if need be
parent
8fa9940f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
9 deletions
+35
-9
dream/simulation/Globals.py
dream/simulation/Globals.py
+1
-0
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+4
-8
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+2
-0
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+28
-1
No files found.
dream/simulation/Globals.py
View file @
3a38d684
...
...
@@ -47,6 +47,7 @@ class G:
EntityList
=
[]
#a list that holds all the Entities
ObjectResourceList
=
[]
ObjectInterruptionList
=
[]
RouterList
=
[]
numberOfReplications
=
1
#the number of replications default=1git
confidenceLevel
=
0.9
#the confidence level default=90%
...
...
dream/simulation/LineGenerationJSON.py
View file @
3a38d684
...
...
@@ -572,7 +572,7 @@ def setTopology():
# initializes all the objects that are in the topology
# ===========================================================================
def
initializeObjects
():
for
element
in
G
.
ObjList
+
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjectInterruptionList
:
for
element
in
G
.
ObjList
+
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjectInterruptionList
+
G
.
RouterList
:
element
.
initialize
()
# ===========================================================================
...
...
@@ -655,13 +655,9 @@ def main(argv=[], input_data=None):
G
.
env
.
run
(
until
=
G
.
maxSimTime
)
#carry on the post processing operations for every object in the topology
for
element
in
G
.
ObjList
:
for
element
in
G
.
ObjList
+
G
.
ObjectResourceList
+
G
.
RouterList
:
element
.
postProcessing
()
#carry on the post processing operations for every model resource in the topology
for
model_resource
in
G
.
ObjectResourceList
:
model_resource
.
postProcessing
()
# added for debugging, print the Route of the Jobs on the same G.traceFile
PrintRoute
.
outputRoute
()
...
...
@@ -682,7 +678,7 @@ def main(argv=[], input_data=None):
#output data to JSON for every object in the topology
for
object
in
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjList
:
for
object
in
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjList
+
G
.
RouterList
:
object
.
outputResultsJSON
()
# output the trace as encoded if it is set on
...
...
dream/simulation/OperatorRouter.py
View file @
3a38d684
...
...
@@ -52,6 +52,8 @@ class Router(ObjectInterruption):
self
.
preemptiveOperators
=
[]
# list of preemptiveOperators that should preempt their machines
self
.
criticalQueues
=
[]
self
.
pending
=
[]
# list of entities that require operators now
from
Globals
import
G
G
.
RouterList
.
append
(
self
)
#===========================================================================
# the initialize method
...
...
dream/simulation/SkilledOperatorRouter.py
View file @
3a38d684
...
...
@@ -42,12 +42,13 @@ class SkilledRouter(Router):
# TODO: we should maybe define a global schedulingRule criterion that will be
# chosen in case of multiple criteria for different Operators
# =======================================================================
def
__init__
(
self
,
sorting
=
False
):
def
__init__
(
self
,
sorting
=
False
,
outputSolutions
=
False
):
Router
.
__init__
(
self
)
# Flag used to notify the need for re-allocation of skilled operators to operatorPools
self
.
allocation
=
False
# Flag used to notify the need to wait for endedLastProcessing signal
waitEndProcess
=
False
self
.
outputSolutions
=
outputSolutions
#===========================================================================
# the initialize method
...
...
@@ -59,6 +60,7 @@ class SkilledRouter(Router):
self
.
pendingQueues
=
[]
self
.
pendingMachines
=
[]
self
.
previousSolution
=
{}
self
.
solutionList
=
[]
# =======================================================================
# the run method
...
...
@@ -163,6 +165,13 @@ class SkilledRouter(Router):
self
.
operators
,
previousAssignment
=
self
.
previousSolution
)
# print '-------'
# print self.env.now, solution
if
self
.
outputSolutions
:
self
.
solutionList
.
append
({
"time"
:
self
.
env
.
now
,
"allocation"
:
solution
})
# XXX assign the operators to operatorPools
# pendingStations/ available stations not yet given operator
self
.
pendingStations
=
[]
...
...
@@ -277,4 +286,22 @@ class SkilledRouter(Router):
Router
.
exitActions
(
self
)
self
.
allocation
=
False
self
.
waitEndProcess
=
False
def
postProcessing
(
self
):
if
self
.
outputSolutions
:
self
.
solutionList
.
append
({
"time"
:
self
.
env
.
now
,
"allocation"
:{}
})
def
outputResultsJSON
(
self
):
if
self
.
outputSolutions
:
from
Globals
import
G
json
=
{
'_class'
:
'Dream.%s'
%
self
.
__class__
.
__name__
,
'id'
:
self
.
id
,
'results'
:
{}}
json
[
'results'
][
'solutionList'
]
=
self
.
solutionList
G
.
outputJSON
[
'elementList'
].
append
(
json
)
\ 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