Commit 4bbb9f52 authored by Georgios Dagkakis's avatar Georgios Dagkakis

remove scenarios that produce the same result

parent b5de2456
...@@ -58,8 +58,20 @@ class Enumeration(plugin.ExecutionPlugin): ...@@ -58,8 +58,20 @@ class Enumeration(plugin.ExecutionPlugin):
break break
i+=1 i+=1
# remove ants that outputs the same schedules
# XXX we in fact remove ants that produce the same output json
scenarioListWithoutDuplicates = []
resultList=[]
for scenario in scenarioList:
scenarioResult = copy(scenario['result']['result_list'][0]['elementList'])
#scenarioResult['general'].pop('totalExecutionTime', None)
if scenarioResult not in resultList:
resultList.append(scenarioResult)
scenarioListWithoutDuplicates.append(scenario)
# rank the scenarios based on their score and take only the numberOfSolutions best # rank the scenarios based on their score and take only the numberOfSolutions best
scenariosToReturn = sorted(scenarioList,key=operator.itemgetter('score'))[:numberOfSolutions] scenariosToReturn = sorted(scenarioListWithoutDuplicates,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 = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment