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
cacc8bec
Commit
cacc8bec
authored
Apr 02, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ACO to create the ants data in separate method
parent
b96b3078
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
dream/plugins/ACO.py
dream/plugins/ACO.py
+14
-10
No files found.
dream/plugins/ACO.py
View file @
cacc8bec
...
@@ -30,15 +30,24 @@ class ACO(plugin.ExecutionPlugin):
...
@@ -30,15 +30,24 @@ class ACO(plugin.ExecutionPlugin):
totalDelay
+=
max
(
delay
,
0
)
totalDelay
+=
max
(
delay
,
0
)
return
totalDelay
return
totalDelay
# creates the collated scenarios, i.e. the list
# of options collated into a dictionary for ease of referencing in ManPy
def
createCollatedScenarios
(
self
,
data
):
def
createCollatedScenarios
(
self
,
data
):
# the list of options collated into a dictionary for ease of referencing in
# ManPy
collated
=
dict
()
collated
=
dict
()
for
node_id
,
node
in
data
[
'graph'
][
'node'
].
items
():
for
node_id
,
node
in
data
[
'graph'
][
'node'
].
items
():
node_class
=
getClassFromName
(
node
[
'_class'
])
node_class
=
getClassFromName
(
node
[
'_class'
])
if
issubclass
(
node_class
,
Queue
)
or
issubclass
(
node_class
,
Operator
):
if
issubclass
(
node_class
,
Queue
)
or
issubclass
(
node_class
,
Operator
):
collated
[
node_id
]
=
list
(
node_class
.
getSupportedSchedulingRules
())
collated
[
node_id
]
=
list
(
node_class
.
getSupportedSchedulingRules
())
return
collated
return
collated
# creates the ant scenario based on what ACO randomly selected
def
createAntData
(
self
,
data
,
ant
):
# set scheduling rule on queues based on ant data
ant_data
=
copy
(
data
)
for
k
,
v
in
ant
.
items
():
ant_data
[
"graph"
][
"node"
][
k
][
'schedulingRule'
]
=
v
return
ant_data
def
run
(
self
,
data
):
def
run
(
self
,
data
):
"""Preprocess the data.
"""Preprocess the data.
...
@@ -82,15 +91,10 @@ class ACO(plugin.ExecutionPlugin):
...
@@ -82,15 +91,10 @@ class ACO(plugin.ExecutionPlugin):
# if the ant was not already tested, only then test it
# if the ant was not already tested, only then test it
if
ant_key
not
in
tested_ants
:
if
ant_key
not
in
tested_ants
:
tested_ants
.
add
(
ant_key
)
tested_ants
.
add
(
ant_key
)
# set scheduling rule on queues based on ant data
ant_data
=
self
.
createAntData
(
data
,
ant
)
ant_data
=
copy
(
data
)
for
k
,
v
in
ant
.
items
():
ant_data
[
"graph"
][
"node"
][
k
][
'schedulingRule'
]
=
v
ant
[
'key'
]
=
ant_key
ant
[
'key'
]
=
ant_key
ant
[
'input'
]
=
ant_data
ant
[
'input'
]
=
ant_data
scenario_list
.
append
(
ant
)
scenario_list
.
append
(
ant
)
if
distributor
is
None
:
if
distributor
is
None
:
...
...
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