Commit 28f99cec authored by Georgios Dagkakis's avatar Georgios Dagkakis

correction. In the end use only the ants that were evaluated under risk analysis

parent b44d6b7b
...@@ -212,6 +212,11 @@ class BatchesStochasticACO(BatchesACO): ...@@ -212,6 +212,11 @@ class BatchesStochasticACO(BatchesACO):
self.outputSheet.write(self.rowIndex,3,-ant['score']) self.outputSheet.write(self.rowIndex,3,-ant['score'])
self.rowIndex+=1 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 we had stochastic evaluation keep only those ants in sorting
if numberOfAntsForStochasticEvaluationInGeneration: if numberOfAntsForStochasticEvaluationInGeneration:
uniqueAntsInThisGeneration = dict() uniqueAntsInThisGeneration = dict()
...@@ -266,6 +271,15 @@ class BatchesStochasticACO(BatchesACO): ...@@ -266,6 +271,15 @@ class BatchesStochasticACO(BatchesACO):
self.outputSheet.write(self.rowIndex,3,-ant['score']) self.outputSheet.write(self.rowIndex,3,-ant['score'])
self.rowIndex+=1 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 # The ants are ranked based on their scores and the
# best (max_results) are selected to be returned # best (max_results) are selected to be returned
ants = sorted(uniqueAnts.values(), ants = sorted(uniqueAnts.values(),
......
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