Commit 0f6e6f6a authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

findCandidateStation updated

parent 53315db5
......@@ -93,6 +93,7 @@ class Operator(ObjectResource):
self.totalOffShiftTime=0 #holds the total off-shift time
self.timeLastShiftStarted=0 #holds the time that the last shift of the object started
self.timeLastShiftEnded=0 #holds the time that the last shift of the object ended
self.candidateStation=None #holds the candidate receiver of the entity the resource will work on - used by router
@staticmethod
def getSupportedSchedulingRules():
......@@ -138,11 +139,13 @@ class Operator(ObjectResource):
def findCandidateStation(self):
from Globals import G
router=G.Router
candidateStation=next(x for x in self.candidateStations if not x in router.conflictingStations)
if not router.sorting:
if not candidateStation:
candidateStation=next(x for x in self.candidateStations)
router.conflictingStations.append(candidateStation)
candidateStation=None
possibleReceivers=[x for x in self.candidateStations if not x in router.conflictingStations and not x in router.getReceivers()]
if possibleReceivers:
candidateStation=next(x for x in possibleReceivers)
if not candidateStation:
candidateStation=next(x for x in self.candidateStations)
router.conflictingStations.append(candidateStation)
return candidateStation
#===========================================================================
......
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