Commit b8ba7eca authored by Georgios Dagkakis's avatar Georgios Dagkakis

Router to be called only if there are machines that starve formore than 30 minutes

parent 25614f17
...@@ -165,6 +165,10 @@ class SkilledRouter(Router): ...@@ -165,6 +165,10 @@ class SkilledRouter(Router):
LPFlag=True LPFlag=True
if self.checkCondition: if self.checkCondition:
LPFlag=self.checkIfAllocationShouldBeCalled() LPFlag=self.checkIfAllocationShouldBeCalled()
# in case there are not available stations or operators there is no need to call the LP
if (not self.availableStationsDict) or (not self.availableOperatorList):
LPFlag=False
#=================================================================== #===================================================================
# # XXX run the LP assignment algorithm # # XXX run the LP assignment algorithm
# # should return a list of correspondences # # should return a list of correspondences
...@@ -173,10 +177,12 @@ class SkilledRouter(Router): ...@@ -173,10 +177,12 @@ class SkilledRouter(Router):
# as it doesn't support zero WIP levels # as it doesn't support zero WIP levels
#=================================================================== #===================================================================
if LPFlag: if LPFlag:
# print self.env.now, 'LP called'
solution=opAss_LP(self.availableStationsDict, self.availableOperatorList, solution=opAss_LP(self.availableStationsDict, self.availableOperatorList,
self.operators, previousAssignment=self.previousSolution, self.operators, previousAssignment=self.previousSolution,
weightFactors=self.weightFactors,Tool=self.tool) weightFactors=self.weightFactors,Tool=self.tool)
else: else:
# print self.env.now, 'no need to call LP'
solution={} solution={}
# print '-------' # print '-------'
# print self.env.now, solution # print self.env.now, solution
...@@ -317,8 +323,13 @@ class SkilledRouter(Router): ...@@ -317,8 +323,13 @@ class SkilledRouter(Router):
self.waitEndProcess=False self.waitEndProcess=False
def checkIfAllocationShouldBeCalled(self): def checkIfAllocationShouldBeCalled(self):
print '*'*10 from Globals import G
# loop through the machines
for machine in G.MachineList:
# if one machine is starved more than 30 then allocation is needed
if (self.env.now-machine.timeLastEntityEnded>=30) and (not machine.isProcessing):
return True return True
return False
def postProcessing(self): def postProcessing(self):
if self.outputSolutions: if self.outputSolutions:
......
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