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
28f99cec
Commit
28f99cec
authored
Nov 12, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction. In the end use only the ants that were evaluated under risk analysis
parent
b44d6b7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
dream/plugins/Batches/BatchesStochasticACO.py
dream/plugins/Batches/BatchesStochasticACO.py
+15
-1
No files found.
dream/plugins/Batches/BatchesStochasticACO.py
View file @
28f99cec
...
...
@@ -199,7 +199,7 @@ class BatchesStochasticACO(BatchesACO):
# be evaluated stochastically
antsForStochasticEvaluationInGeneration
=
sorted
(
uniqueAntsInThisGeneration
.
values
(),
key
=
operator
.
itemgetter
(
'score'
))[:
numberOfAntsForStochasticEvaluationInGeneration
]
for
ant
in
antsForStochasticEvaluationInGeneration
:
ant
[
'input'
]
=
self
.
createStochasticData
(
ant
[
'input'
])
ant
[
'input'
][
'general'
][
'numberOfReplications'
]
=
numberOfReplicationsInGeneration
...
...
@@ -212,6 +212,11 @@ class BatchesStochasticACO(BatchesACO):
self
.
outputSheet
.
write
(
self
.
rowIndex
,
3
,
-
ant
[
'score'
])
self
.
rowIndex
+=
1
# # for the ants that were not evaluated stochastically set score = 0
# antsNotEvaluatedStochastically=[x for x in uniqueAntsInThisGeneration if x not in antsForStochasticEvaluationInGeneration]
# for ant in antsNotEvaluatedStochastically:
# ant['score']=0
# if we had stochastic evaluation keep only those ants in sorting
if
numberOfAntsForStochasticEvaluationInGeneration
:
uniqueAntsInThisGeneration
=
dict
()
...
...
@@ -266,6 +271,15 @@ class BatchesStochasticACO(BatchesACO):
self
.
outputSheet
.
write
(
self
.
rowIndex
,
3
,
-
ant
[
'score'
])
self
.
rowIndex
+=
1
# from all the ants in the experiment remove ants that outputs the same schedules
# XXX we in fact remove ants that produce the same output json
uniqueAnts
=
dict
()
for
ant
in
ants
:
ant_result
,
=
copy
(
ant
[
'result'
][
'result_list'
])
ant_result
[
'general'
].
pop
(
'totalExecutionTime'
,
None
)
ant_result
=
json
.
dumps
(
ant_result
,
sort_keys
=
True
)
uniqueAnts
[
ant_result
]
=
ant
# The ants are ranked based on their scores and the
# best (max_results) are selected to be returned
ants
=
sorted
(
uniqueAnts
.
values
(),
...
...
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