Commit 87acf8a4 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

Earliest Due Date, Earliest Order Date and Number Of Remaining Stations...

Earliest Due Date, Earliest Order Date and Number Of Remaining Stations scheduling rules implemented
parent 54b61177
......@@ -29,7 +29,7 @@ Class that acts as an abstract. It should have no instances. All the Entities sh
class Entity(object):
type="Entity"
def __init__(self, name, priority=0):
def __init__(self, name, priority=0, dueDate=0, orderDate=0):
self.name=name
self.currentStop=None #contains the current object that the material is in
self.creationTime=0
......@@ -38,4 +38,7 @@ class Entity(object):
self.width=1.0
self.height=1.0
self.length=1.0
self.priority=priority
\ No newline at end of file
self.priority=priority
self.dueDate=dueDate
self.orderDate=orderDate
\ No newline at end of file
......@@ -74,7 +74,7 @@
"Q2": {
"_class": "Dream.QueueJobShop",
"name": "Queue2",
"schedulingRule": "Priority",
"schedulingRule": "NumStations",
"isDummy": "0",
"capacity": "1000"
},
......@@ -93,6 +93,8 @@
"_class": "Dream.Job",
"name": "Job1",
"priority": "1",
"dueDate": "900",
"orderDate": "5",
"route": [
{
"stepNumber": "0",
......@@ -132,6 +134,8 @@
"_class": "Dream.Job",
"name": "Job2",
"priority": "7",
"dueDate": "100",
"orderDate": "3",
"route": [
{
"stepNumber": "0",
......@@ -171,6 +175,8 @@
"_class": "Dream.Job",
"name": "Job3",
"priority": "3",
"dueDate": "200",
"orderDate": "2",
"route": [
{
"stepNumber": "0",
......@@ -202,6 +208,8 @@
"_class": "Dream.Job",
"name": "Job4",
"priority": "1",
"dueDate": "99",
"orderDate": "1.5",
"route": [
{
"stepNumber": "0",
......
......@@ -33,8 +33,8 @@ from Entity import Entity
class Job(Entity):
type="Job"
def __init__(self, id, name, route, priority=0):
Entity.__init__(self, name, priority)
def __init__(self, id, name, route, priority=0, dueDate=0, orderDate=0):
Entity.__init__(self, name, priority=priority, dueDate=dueDate, orderDate=orderDate)
self.id=id
self.fullRoute=route #the route that the job follows, also contains the processing times in each station
self.remainingRoute=route #the remaining route. in the beginning this should be the same as the full route
......@@ -42,6 +42,5 @@ class Job(Entity):
\ No newline at end of file
......@@ -290,6 +290,8 @@ def createObjects():
id=element.get('id', 'not found')
name=element.get('name', 'not found')
priority=int(element.get('priority', '0'))
dueDate=float(element.get('dueDate', '0'))
orderDate=float(element.get('orderDate', '0'))
JSONRoute=element.get('route', [])
route=[]
for i in range(len(JSONRoute)):
......@@ -301,7 +303,7 @@ def createObjects():
distributionType=processingTime.get('distributionType', 'not found')
mean=int(processingTime.get('mean', 'not found'))
route[stepNumber]=[nextId, mean]
J=Job(id, name, route, priority=priority)
J=Job(id, name, route, priority=priority, dueDate=dueDate, orderDate=orderDate)
G.JobList.append(J)
G.WipList.append(J)
G.EntityList.append(J)
......
......@@ -177,10 +177,22 @@ class Queue(CoreObject):
#sorts the Entities of the Queue according to the scheduling rule
def sortEntities(self):
activeObjectQ=self.Res.activeQ
if self.schedulingRule=="FIFO":
schedulingRule=self.schedulingRule
#if the schedulingRule is first in first out
if schedulingRule=="FIFO":
pass
elif self.schedulingRule=="Priority":
activeObjectQ.sort(key=lambda x: x.priority, reverse=True)
#if the schedulingRule is based on a pre-defined prioriy
elif schedulingRule=="Priority":
activeObjectQ.sort(key=lambda x: x.priority, reverse=True)
#if the schedulingRule is earliest due date
elif schedulingRule=="EDD":
activeObjectQ.sort(key=lambda x: x.dueDate)
#if the schedulingRule is earliest order date
elif schedulingRule=="EOD":
activeObjectQ.sort(key=lambda x: x.orderDate)
#if the schedulingRule is to short Entities according to the stations they have to visit
elif schedulingRule=="NumStations":
activeObjectQ.sort(key=lambda x: len(x.remainingRoute), reverse=True)
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | message)
def outputTrace(self, entityName, message):
......
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