Commit d79769bd authored by Georgios Dagkakis's avatar Georgios Dagkakis

correction on how the router uses the solution of the assignment"

parent 1f79598b
...@@ -211,38 +211,21 @@ class SkilledRouter(Router): ...@@ -211,38 +211,21 @@ class SkilledRouter(Router):
# pendingStations/ available stations not yet given operator # pendingStations/ available stations not yet given operator
self.pendingStations=[] self.pendingStations=[]
from Globals import findObjectById from Globals import findObjectById
for operator in solution.keys(): # apply the solution
for resource in G.OperatorsList: # loop through the entries in the solution dictionary
if resource.id==operator: for operatorID in solution.keys():
station=findObjectById(solution[operator]) # obtain the operator and the station
station.operatorPool.operators=[resource] operator=findObjectById(operatorID)
resource.assignTo(station) station=findObjectById(solution[operatorID])
self.toBeSignalled.append(station) # update the operatorPool of the station
i=0
for op in self.availableOperatorList:
if op==resource.id:
self.availableOperatorList.pop(i)
break
i+=1
break
if len(solution)!=len(self.availableStations):
from Globals import findObjectById
for station in self.availableStations:
if not station.id in solution.keys():
for i in range(len(self.availableOperatorList)):
for resource in G.OperatorsList:
if resource.id==self.availableOperatorList[i]:
candidate=resource
if station.id in candidate.skillsList:
operatorID=self.availableOperatorList.pop(i)
break
#operator=findObjectById(operatorID)
for resource in G.OperatorsList:
if resource.id==operatorID:
operator=resource
station.operatorPool.operators=[operator] station.operatorPool.operators=[operator]
# assign the operator to the station
operator.assignTo(station) operator.assignTo(station)
# append the station to the ones that are to be signalled
self.toBeSignalled.append(station) self.toBeSignalled.append(station)
# remove the operator id from availableOperatorList
self.availableOperatorList.remove(operatorID)
#=================================================================== #===================================================================
# # XXX signal the stations that the assignment is complete # # XXX signal the stations that the assignment is complete
#=================================================================== #===================================================================
......
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