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
a0466d64
Commit
a0466d64
authored
Jun 04, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enumeration to score the scenarios
parent
102a87d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
dream/plugins/Enumeration.py
dream/plugins/Enumeration.py
+4
-3
No files found.
dream/plugins/Enumeration.py
View file @
a0466d64
...
@@ -45,18 +45,19 @@ class Enumeration(plugin.ExecutionPlugin):
...
@@ -45,18 +45,19 @@ class Enumeration(plugin.ExecutionPlugin):
start
=
time
.
time
()
# start counting execution time
start
=
time
.
time
()
# start counting execution time
numberOfSolutions
=
int
(
data
[
'general'
].
get
(
'numberOfSolutions'
,
0
))
numberOfSolutions
=
int
(
data
[
'general'
].
get
(
'numberOfSolutions'
,
3
))
assert
numberOfSolutions
>=
1
assert
numberOfSolutions
>=
1
scenarioList
=
self
.
createScenarioList
(
data
)
scenarioList
=
self
.
createScenarioList
(
data
)
for
scenario
in
scenarioList
:
for
scenario
in
scenarioList
:
scenario
[
'input'
]
=
self
.
createScenarioData
(
data
,
scenario
)
scenario
[
'input'
]
=
self
.
createScenarioData
(
data
,
scenario
)
scenario
[
'result'
]
=
self
.
runOneScenario
(
scenario
[
'input'
])[
'result'
]
scenario
[
'result'
]
=
self
.
runOneScenario
(
scenario
[
'input'
])[
'result'
]
scenario
[
'score'
]
=
self
.
calculateScenarioScore
(
scenario
)
if
self
.
checkIfShouldTerminate
(
data
,
scenarioList
):
if
self
.
checkIfShouldTerminate
(
data
,
scenarioList
):
break
break
# rand the scenarios based on their score and take only the numberOfSolutions best
# rand the scenarios based on their score and take only the numberOfSolutions best
scenariosToReturn
=
sorted
(
scenarioList
.
values
()
,
key
=
operator
.
itemgetter
(
'score'
))[:
numberOfSolutions
]
scenariosToReturn
=
sorted
(
scenarioList
,
key
=
operator
.
itemgetter
(
'score'
))[:
numberOfSolutions
]
# return the number of scenarios that need to be returned
# return the number of scenarios that need to be returned
data
[
'result'
][
'result_list'
]
=
result_list
=
[]
data
[
'result'
][
'result_list'
]
=
result_list
=
[]
...
...
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