sortEntities of operator corrected; further refinment needed. Seed def should...

sortEntities of operator corrected; further refinment needed. Seed def should be updated in other examples of JobShop
parent 9dd6535c
......@@ -51,10 +51,10 @@
"type": "number"
},
"seed": {
"default": "",
"default": 10,
"description": "When using the same seed, the random number generator produce the same sequence of numbers",
"title": "Seed for random number generator",
"type": "string"
"type": "number"
},
"timeUnit": {
"default": "hour",
......@@ -1045,7 +1045,7 @@
"numberOfReplications": "1",
"numberOfSolutions": "2",
"processTimeout": 10,
"seed": "",
"seed": 10,
"timeUnit": "hour",
"trace": "Yes"
},
......
......@@ -204,16 +204,15 @@ class Operator(ObjectResource):
for entity in activeObjectQ:
RPT=0
for step in entity.remainingRoute:
processingTime=step.get('processingTime',None)
processingTime=step.get('processingTime',{})
if processingTime:
RPT+=float(processingTime.get('Fixed',{}).get('mean',0))
entity.remainingProcessingTime=RPT
activeObjectQ.sort(key=lambda x: x.remainingProcessingTime, reverse=True)
#if the schedulingRule is to sort Entities according to longest processing time first in the next station
elif criterion=="LPT":
for entity in activeObjectQ:
processingTime = entity.remainingRoute[0].get('processingTime',None)
processingTime = entity.remainingRoute[0].get('processingTime',{})
entity.processingTimeInNextStation=float(processingTime.get('Fixed',{}).get('mean',0))
if processingTime:
entity.processingTimeInNextStation=float(processingTime.get('Fixed',{}).get('mean',0))
......@@ -224,7 +223,7 @@ class Operator(ObjectResource):
elif criterion=="SPT":
for entity in activeObjectQ:
processingTime = entity.remainingRoute[0].get('processingTime',None)
processingTime = entity.remainingRoute[0].get('processingTime',{})
if processingTime:
entity.processingTimeInNextStation=float(processingTime.get('Fixed',{}).get('mean',0))
else:
......@@ -236,21 +235,23 @@ class Operator(ObjectResource):
for entity in activeObjectQ:
RPT=0
for step in entity.remainingRoute:
processingTime=step.get('processingTime',None)
processingTime=step.get('processingTime',{})
if processingTime:
RPT+=float(processingTime.get('Fixed',{}).get('mean',0))
entity.remainingProcessingTime=RPT
activeObjectQ.sort(key=lambda x: (x.dueDate-x.remainingProcessingTime))
#if the schedulingRule is to sort Entities based on the length of the following Queue
elif criterion=="WINQ":
from Globals import G
for entity in activeObjectQ:
nextObjIds=entity.remainingRoute[1].get('stationIdsList',[])
for obj in G.ObjList:
if obj.id in nextObjIds:
nextObject=obj
entity.nextQueueLength=len(nextObject.getActiveObjectQueue())
if len(entity.remainingRoute)>1:
nextObjIds=entity.remainingRoute[1].get('stationIdsList',[])
for obj in G.ObjList:
if obj.id in nextObjIds:
nextObject=obj
entity.nextQueueLength=len(nextObject.getActiveObjectQueue())
else:
entity.nextQueueLength = 0
activeObjectQ.sort(key=lambda x: x.nextQueueLength)
else:
assert False, "Unknown scheduling criterion %r" % (criterion, )
......@@ -360,4 +361,4 @@ class Operator(ObjectResource):
G.cells_to_write.append({'row':step+1,
'col':col_to_write,
'worker':self.alias})
G.routeTraceSheet.write(step+1, col_to_write, self.alias)
\ No newline at end of file
G.routeTraceSheet.write(step+1, col_to_write, self.alias)
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