Commit cbd6fab6 authored by Georgios Dagkakis's avatar Georgios Dagkakis

changes to make stochastic simulation lighter

parent c1c384a3
...@@ -60,7 +60,8 @@ class AddBatchStations(plugin.InputPreparationPlugin): ...@@ -60,7 +60,8 @@ class AddBatchStations(plugin.InputPreparationPlugin):
for node_id, node in nodes.iteritems(): for node_id, node in nodes.iteritems():
if node['_class']=='Dream.BatchReassembly': if node['_class']=='Dream.BatchReassembly':
data['graph']['node'][node_id]['_class']='Dream.BatchReassemblyBlocking' data['graph']['node'][node_id]['_class']='Dream.BatchReassemblyBlocking'
data['graph']['node'][node_id]['outputResults']=1 if node_id.startswith('St8R'):
data['graph']['node'][node_id]['outputResults']=1
# loop in BatchDecompositions to change the classes to BatchDecompositionStartTime for the ones that # loop in BatchDecompositions to change the classes to BatchDecompositionStartTime for the ones that
# are just after the source # are just after the source
...@@ -113,7 +114,7 @@ class AddBatchStations(plugin.InputPreparationPlugin): ...@@ -113,7 +114,7 @@ class AddBatchStations(plugin.InputPreparationPlugin):
"mean": 0 "mean": 0
} }
}, },
"outputResults": 1, "outputResults": 0,
"numberOfSubBatches": numberOfSubBatches, "numberOfSubBatches": numberOfSubBatches,
"wip": [], "wip": [],
"_class": "Dream.BatchReassemblyBlocking", "_class": "Dream.BatchReassemblyBlocking",
...@@ -133,7 +134,7 @@ class AddBatchStations(plugin.InputPreparationPlugin): ...@@ -133,7 +134,7 @@ class AddBatchStations(plugin.InputPreparationPlugin):
# set all the Queue types to gether wip data # set all the Queue types to gether wip data
for node in data["graph"]["node"].values(): for node in data["graph"]["node"].values():
if node['_class'] in ['Dream.Queue', 'Dream.LineClearance', 'Dream.RoutingQueue']: if node['_class'] in ['Dream.Queue', 'Dream.LineClearance', 'Dream.RoutingQueue']:
node['gatherWipStat'] = 1 node['gatherWipStat'] = 0
return data return data
......
...@@ -233,7 +233,8 @@ class BatchesStochasticACO(BatchesACO): ...@@ -233,7 +233,8 @@ class BatchesStochasticACO(BatchesACO):
for ant in antsInCurrentGeneration: for ant in antsInCurrentGeneration:
if ant['evaluationType']=='deterministic': if ant['evaluationType']=='deterministic':
ant['score']=0 ant['score']=0
# ants.remove(ant)
# 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()
...@@ -241,10 +242,15 @@ class BatchesStochasticACO(BatchesACO): ...@@ -241,10 +242,15 @@ class BatchesStochasticACO(BatchesACO):
ant_result, = copy(ant['result']['result_list']) ant_result, = copy(ant['result']['result_list'])
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
antsForNextGeneration = sorted(uniqueAntsInThisGeneration.values(), antsForNextGeneration = sorted(uniqueAntsInThisGeneration.values(),
key=operator.itemgetter('score'))[:numberOfAntsForNextGeneration] key=operator.itemgetter('score'))[:numberOfAntsForNextGeneration]
# Keep only ants that carry pheromone at the ants list
for ant in antsInCurrentGeneration:
if not ant in antsForNextGeneration:
ants.remove(ant)
for l in antsForNextGeneration: for l in antsForNextGeneration:
self.outputSheet.write(self.rowIndex,1,'Ant to carry pheromone to next generation') self.outputSheet.write(self.rowIndex,1,'Ant to carry pheromone to next generation')
self.outputSheet.write(self.rowIndex,2,l['key']) self.outputSheet.write(self.rowIndex,2,l['key'])
......
...@@ -71,7 +71,7 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin): ...@@ -71,7 +71,7 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
node['SkilledRouter01']={ #(random id) node['SkilledRouter01']={ #(random id)
"_class": "dream.simulation.SkilledOperatorRouter.SkilledRouter", "_class": "dream.simulation.SkilledOperatorRouter.SkilledRouter",
"name": "SkilledRouter01", "name": "SkilledRouter01",
"outputSolutions":1, "outputSolutions":0,
"twoPhaseSearch": int(data['general'].get('twoPhaseSearch',0)), "twoPhaseSearch": int(data['general'].get('twoPhaseSearch',0)),
"checkCondition":1 "checkCondition":1
} }
......
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