Commit 6ea4f45b authored by Georgios Dagkakis's avatar Georgios Dagkakis

set an evaluationType attribute to ants so that it can be understood if they...

set an evaluationType attribute to ants so that it can be understood if they were evaluated deterministically or stochastically
parent 3c939200
...@@ -173,6 +173,7 @@ class BatchesStochasticACO(BatchesACO): ...@@ -173,6 +173,7 @@ class BatchesStochasticACO(BatchesACO):
self.rowIndex+=1 self.rowIndex+=1
ant['result'] = self.runOneScenario(ant['input'])['result'] ant['result'] = self.runOneScenario(ant['input'])['result']
ant['score'] = self._calculateAntScore(ant) ant['score'] = self._calculateAntScore(ant)
ant['evaluationType']='deterministic'
self.outputSheet.write(self.rowIndex,2,'Units Throughput') self.outputSheet.write(self.rowIndex,2,'Units Throughput')
self.outputSheet.write(self.rowIndex,3,-ant['score']) self.outputSheet.write(self.rowIndex,3,-ant['score'])
self.rowIndex+=1 self.rowIndex+=1
...@@ -203,6 +204,7 @@ class BatchesStochasticACO(BatchesACO): ...@@ -203,6 +204,7 @@ class BatchesStochasticACO(BatchesACO):
self.outputSheet.write(self.rowIndex,2,ant['key']) self.outputSheet.write(self.rowIndex,2,ant['key'])
self.rowIndex+=1 self.rowIndex+=1
ant['result'] = self.runOneScenario(ant['input'])['result'] ant['result'] = self.runOneScenario(ant['input'])['result']
ant['evaluationType']='stochastic'
ant['score'] = self.calculateStochasticAntScore(ant) ant['score'] = self.calculateStochasticAntScore(ant)
self.outputSheet.write(self.rowIndex,2,'Average Units Throughput') self.outputSheet.write(self.rowIndex,2,'Average Units Throughput')
self.outputSheet.write(self.rowIndex,3,-ant['score']) self.outputSheet.write(self.rowIndex,3,-ant['score'])
...@@ -210,11 +212,7 @@ class BatchesStochasticACO(BatchesACO): ...@@ -210,11 +212,7 @@ class BatchesStochasticACO(BatchesACO):
# for the ants that were not evaluated stochastically set score = 0 # for the ants that were not evaluated stochastically set score = 0
for ant in antsInCurrentGeneration: for ant in antsInCurrentGeneration:
antEvaluatedStochastically=False if ant['evaluationType']=='deterministic':
for stochasticAnt in antsForStochasticEvaluationInGeneration:
if ant['key'] == stochasticAnt['key']:
antEvaluatedStochastically=True
if not antEvaluatedStochastically:
ant['score']=0 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
......
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