Commit d413a62a authored by Georgios Dagkakis's avatar Georgios Dagkakis

do not remove ants that produce the same deterministic result

parent 3b5a2c7d
...@@ -139,12 +139,15 @@ class BatchesStochasticACO(BatchesACO): ...@@ -139,12 +139,15 @@ class BatchesStochasticACO(BatchesACO):
# in this generation remove ants that outputs the same schedules # in this generation remove ants that outputs the same schedules
# XXX we in fact remove ants that produce the same output json # XXX we in fact remove ants that produce the same output json
# XXX in the stochastic case maybe there is not benefit to remove ants.
# XXX so I kept totalExecutionTime to have them all
uniqueAntsInThisGeneration = dict() uniqueAntsInThisGeneration = dict()
for ant in antsInCurrentGeneration: for ant in antsInCurrentGeneration:
ant_result, = copy(ant['result']['result_list']) ant_result, = copy(ant['result']['result_list'])
ant_result['general'].pop('totalExecutionTime', None) # ant_result['general'].pop('totalExecutionTime', None)
ant_result = json.dumps(ant_result, sort_keys=True) ant_result = json.dumps(ant_result, sort_keys=True)
uniqueAntsInThisGeneration[ant_result] = ant uniqueAntsInThisGeneration[ant_result] = ant
print ant_result
# 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 (numberOfAntsForNextGeneration) are selected to carry their pheromones to next generation # best (numberOfAntsForNextGeneration) are selected to carry their pheromones to next generation
......
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