Commit 25614f17 authored by Georgios Dagkakis's avatar Georgios Dagkakis

set SkilledRouter to call a method to check the condition of the system to...

set SkilledRouter to call a method to check the condition of the system to establish if allocation should be called. Conditions not implemented yet
parent cec121df
...@@ -55,5 +55,12 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin): ...@@ -55,5 +55,12 @@ class ReadSkilledOperators(plugin.InputPreparationPlugin):
"_class": "Dream.EventGenerator", "_class": "Dream.EventGenerator",
"method": "Dream.ManPyObject.requestAllocation" "method": "Dream.ManPyObject.requestAllocation"
} }
# add EventGenerator for the allocation every 10 minutes
node['SkilledRouter01']={ #(random id)
"_class": "dream.simulation.SkilledOperatorRouter.SkilledRouter",
"name": "SkilledRouter01",
"outputSolutions":1,
"checkCondition":1
}
return data return data
...@@ -43,7 +43,7 @@ class SkilledRouter(Router): ...@@ -43,7 +43,7 @@ class SkilledRouter(Router):
# chosen in case of multiple criteria for different Operators # chosen in case of multiple criteria for different Operators
# ======================================================================= # =======================================================================
def __init__(self,id='SkilledRouter01',name='SkilledRouter01',sorting=False,outputSolutions=True, def __init__(self,id='SkilledRouter01',name='SkilledRouter01',sorting=False,outputSolutions=True,
weightFactors=[2, 1, 0, 2, 1, 1], tool={},**kw): weightFactors=[2, 1, 0, 2, 1, 1], tool={},checkCondition=False,**kw):
Router.__init__(self) Router.__init__(self)
# Flag used to notify the need for re-allocation of skilled operators to operatorPools # Flag used to notify the need for re-allocation of skilled operators to operatorPools
self.allocation=False self.allocation=False
...@@ -54,6 +54,7 @@ class SkilledRouter(Router): ...@@ -54,6 +54,7 @@ class SkilledRouter(Router):
self.name=name self.name=name
self.weightFactors=weightFactors self.weightFactors=weightFactors
self.tool=tool self.tool=tool
self.checkCondition=checkCondition
#=========================================================================== #===========================================================================
# the initialize method # the initialize method
...@@ -159,6 +160,11 @@ class SkilledRouter(Router): ...@@ -159,6 +160,11 @@ class SkilledRouter(Router):
for operator in G.OperatorsList: for operator in G.OperatorsList:
if operator.available and operator.onShift: if operator.available and operator.onShift:
self.availableOperatorList.append(operator.id) self.availableOperatorList.append(operator.id)
LPFlag=True
if self.checkCondition:
LPFlag=self.checkIfAllocationShouldBeCalled()
#=================================================================== #===================================================================
# # XXX run the LP assignment algorithm # # XXX run the LP assignment algorithm
# # should return a list of correspondences # # should return a list of correspondences
...@@ -166,9 +172,12 @@ class SkilledRouter(Router): ...@@ -166,9 +172,12 @@ class SkilledRouter(Router):
# TODO: a constant integer must be added to all WIP before provided to the opAss_LP # TODO: a constant integer must be added to all WIP before provided to the opAss_LP
# as it doesn't support zero WIP levels # as it doesn't support zero WIP levels
#=================================================================== #===================================================================
solution=opAss_LP(self.availableStationsDict, self.availableOperatorList, if LPFlag:
self.operators, previousAssignment=self.previousSolution, solution=opAss_LP(self.availableStationsDict, self.availableOperatorList,
weightFactors=self.weightFactors,Tool=self.tool) self.operators, previousAssignment=self.previousSolution,
weightFactors=self.weightFactors,Tool=self.tool)
else:
solution={}
# print '-------' # print '-------'
# print self.env.now, solution # print self.env.now, solution
...@@ -306,6 +315,10 @@ class SkilledRouter(Router): ...@@ -306,6 +315,10 @@ class SkilledRouter(Router):
Router.exitActions(self) Router.exitActions(self)
self.allocation=False self.allocation=False
self.waitEndProcess=False self.waitEndProcess=False
def checkIfAllocationShouldBeCalled(self):
print '*'*10
return True
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