Commit 2f06bfea authored by Sebastien Robin's avatar Sebastien Robin

General: remove usage of stepNumber on routes

This information was only a duplicate of information. The stepNumber
is already available has the position of the step in the route list.
parent 39dbf389
...@@ -116,7 +116,6 @@ class Simulation(ACO.Simulation): ...@@ -116,7 +116,6 @@ class Simulation(ACO.Simulation):
# two times Decomposition # two times Decomposition
predecessor_set = set() predecessor_set = set()
route_list = [] route_list = []
route_counter = 0
for j, sequence_step in enumerate(sequence_list): for j, sequence_step in enumerate(sequence_list):
for predecessor_step in self.getNotMachineNodePredecessorList(sequence_step): for predecessor_step in self.getNotMachineNodePredecessorList(sequence_step):
# We avoid having two time Decomposition in the route. XXX Is this correct ? # We avoid having two time Decomposition in the route. XXX Is this correct ?
...@@ -124,12 +123,9 @@ class Simulation(ACO.Simulation): ...@@ -124,12 +123,9 @@ class Simulation(ACO.Simulation):
continue continue
predecessor_set.add(predecessor_step) predecessor_set.add(predecessor_step)
route = {"stationIdsList": [predecessor_step], route = {"stationIdsList": [predecessor_step],
"stepNumber": "%i" % route_counter
} }
route_list.append(route) route_list.append(route)
route_counter += 1
route = {"stationIdsList": list(self.getMachineNameSet(sequence_step)), route = {"stationIdsList": list(self.getMachineNameSet(sequence_step)),
"stepNumber": "%i" % route_counter,
"processingTime": {"distributionType": "Fixed", "processingTime": {"distributionType": "Fixed",
"mean": "%i" % int(processing_time_list[j])}, "mean": "%i" % int(processing_time_list[j])},
"setupTime": {"setupDistribution": "Fixed", "setupTime": {"setupDistribution": "Fixed",
...@@ -138,14 +134,6 @@ class Simulation(ACO.Simulation): ...@@ -138,14 +134,6 @@ class Simulation(ACO.Simulation):
if prerequisite_list: if prerequisite_list:
route["prerequisites"] = prerequisite_list route["prerequisites"] = prerequisite_list
route_list.append(route) route_list.append(route)
route_counter += 1
"""
if sequence_step == "IM":
route_counter += 1
route_list.append({"stationIdsList": ["E1"],
"stepNumber": "%i" % route_counter})
route_counter += 1
"""
return route_list return route_list
def getListFromString(self, my_string): def getListFromString(self, my_string):
...@@ -223,10 +211,6 @@ class Simulation(ACO.Simulation): ...@@ -223,10 +211,6 @@ class Simulation(ACO.Simulation):
prerequisite_list) prerequisite_list)
if part_type == "Mould": if part_type == "Mould":
route_list = route_list[1:] route_list = route_list[1:]
counter = 0
for route in route_list:
route["stepNumber"] = "%i" % counter
counter += 1
component_dict["route"] = route_list component_dict["route"] = route_list
i+=1 i+=1
order_dict["componentsList"] = component_list order_dict["componentsList"] = component_list
......
...@@ -1010,12 +1010,7 @@ def createWIP(): ...@@ -1010,12 +1010,7 @@ def createWIP():
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation route = [x for x in JSONRoute] # copy JSONRoute
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
...@@ -1075,12 +1070,7 @@ def createWIP(): ...@@ -1075,12 +1070,7 @@ def createWIP():
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation route = [x for x in JSONRoute] # copy JSONRoute
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
...@@ -1125,12 +1115,7 @@ def createWIP(): ...@@ -1125,12 +1115,7 @@ def createWIP():
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation route = [x for x in JSONRoute] # copy JSONRoute
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
...@@ -1198,12 +1183,7 @@ def createWIP(): ...@@ -1198,12 +1183,7 @@ def createWIP():
JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs JSONRoute=entity.get('route', []) # dummy variable that holds the routes of the jobs
# the route from the JSON file # the route from the JSON file
# is a sequence of dictionaries # is a sequence of dictionaries
route = [None for i in range(len(JSONRoute))] # variable that holds the argument used in the Job initiation route = [x for x in JSONRoute] # copy JSONRoute
# hold None for each entry in the 'route' list
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
......
...@@ -39,7 +39,6 @@ as a dictionary with the following layout if the mould is not already in WIP ...@@ -39,7 +39,6 @@ as a dictionary with the following layout if the mould is not already in WIP
}, },
"route": [ "route": [
{ {
"stepNumber": "0",
"stationIdsList": [ "stationIdsList": [
"MA1" "MA1"
], # the mould assembly stations ], # the mould assembly stations
...@@ -49,7 +48,6 @@ as a dictionary with the following layout if the mould is not already in WIP ...@@ -49,7 +48,6 @@ as a dictionary with the following layout if the mould is not already in WIP
} }
}, },
{ {
"stepNumber": "1",
"stationIdsList": [ "stationIdsList": [
"IM1" "IM1"
], # the injection moulding station ], # the injection moulding station
...@@ -219,11 +217,7 @@ class MouldAssembly(MachineManagedJob): ...@@ -219,11 +217,7 @@ class MouldAssembly(MachineManagedJob):
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries # dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
JSONRoute=component.get('route', []) JSONRoute=component.get('route', [])
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list # variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
route = [None for i in range(len(JSONRoute))] route = [x for x in JSONRoute] # copy JSONRoute
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumbe
route[stepNumber]=routeentity
# assert that the assembler is in the moulds route and update the initial step of the mould's route # assert that the assembler is in the moulds route and update the initial step of the mould's route
firstStep = route.pop(0) firstStep = route.pop(0)
assert (self.id in firstStep.get('stationIdsList',[])),\ assert (self.id in firstStep.get('stationIdsList',[])),\
......
...@@ -214,11 +214,7 @@ class OrderDecomposition(CoreObject): ...@@ -214,11 +214,7 @@ class OrderDecomposition(CoreObject):
# dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries # dummy variable that holds the routes of the jobs the route from the JSON file is a sequence of dictionaries
JSONRoute=component.get('route', []) JSONRoute=component.get('route', [])
# variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list # variable that holds the argument used in the Job initiation hold None for each entry in the 'route' list
route = [None for i in range(len(JSONRoute))] route = [x for x in JSONRoute]
for routeentity in JSONRoute: # for each 'step' dictionary in the JSONRoute
stepNumber=int(routeentity.get('stepNumber', '0')) # get the stepNumber
route[stepNumber]=routeentity
# keep a reference of all extra properties passed to the job # keep a reference of all extra properties passed to the job
extraPropertyDict = {} extraPropertyDict = {}
......
...@@ -70,6 +70,7 @@ def format(m): ...@@ -70,6 +70,7 @@ def format(m):
if 'route' in job: if 'route' in job:
for r in job['route']: for r in job['route']:
print r print r
r.pop("stepNumber", None)
if 'processingTime' in r: if 'processingTime' in r:
processingTime = r['processingTime'] processingTime = r['processingTime']
if 'mean' in processingTime: if 'mean' in processingTime:
......
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