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
4e38a114
Commit
4e38a114
authored
May 08, 2015
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ACO: use two different variables (patch under discussion)
parent
e612e1d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
dream/plugins/ACO.py
dream/plugins/ACO.py
+7
-3
No files found.
dream/plugins/ACO.py
View file @
4e38a114
...
@@ -74,6 +74,8 @@ class ACO(plugin.ExecutionPlugin):
...
@@ -74,6 +74,8 @@ class ACO(plugin.ExecutionPlugin):
max_results
=
int
(
data
[
'general'
].
get
(
'numberOfSolutions'
,
0
))
max_results
=
int
(
data
[
'general'
].
get
(
'numberOfSolutions'
,
0
))
assert
max_results
>=
1
assert
max_results
>=
1
numberOfAntsForNextGeneration
=
int
(
data
[
'general'
].
get
(
'numberOfAntsForNextGeneration'
,
max_results
))
ants
=
[]
#list of ants for keeping track of their performance
ants
=
[]
#list of ants for keeping track of their performance
# Number of times new ants are to be created, i.e. number of generations (a
# Number of times new ants are to be created, i.e. number of generations (a
...
@@ -163,9 +165,11 @@ class ACO(plugin.ExecutionPlugin):
...
@@ -163,9 +165,11 @@ class ACO(plugin.ExecutionPlugin):
ants_without_duplicates
[
ant_result
]
=
ant
ants_without_duplicates
[
ant_result
]
=
ant
# The ants in this generation are ranked based on their scores and the
# The ants in this generation are ranked based on their scores and the
# best (max_results) are selected
# best (numberOfAntsForNextGeneration) are added again to the list to increase
# the probability of their characteristics since they are more likely to
# be selected again
ants
=
sorted
(
ants_without_duplicates
.
values
(),
ants
=
sorted
(
ants_without_duplicates
.
values
(),
key
=
operator
.
itemgetter
(
'score'
))[:
max_results
]
key
=
operator
.
itemgetter
(
'score'
))[:
numberOfAntsForNextGeneration
]
for
l
in
ants
:
for
l
in
ants
:
# update the options list to ensure that good performing queue-rule
# update the options list to ensure that good performing queue-rule
...
@@ -178,7 +182,7 @@ class ACO(plugin.ExecutionPlugin):
...
@@ -178,7 +182,7 @@ class ACO(plugin.ExecutionPlugin):
collated
[
m
].
append
(
l
[
m
])
collated
[
m
].
append
(
l
[
m
])
data
[
'result'
][
'result_list'
]
=
result_list
=
[]
data
[
'result'
][
'result_list'
]
=
result_list
=
[]
for
ant
in
ants
:
for
ant
in
ants
[:
max_results
]
:
result
,
=
ant
[
'result'
][
'result_list'
]
result
,
=
ant
[
'result'
][
'result_list'
]
result
[
'score'
]
=
ant
[
'score'
]
result
[
'score'
]
=
ant
[
'score'
]
result
[
'key'
]
=
ant
[
'key'
]
result
[
'key'
]
=
ant
[
'key'
]
...
...
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