def loadPlantAndOrderList(args): plantName = args[0] orderListName = args[1] configName = args[2] plant = Plant.fromXmlFile(plantFileExists(plantName)) orderList = OrderList.fromXmlFile(orderListExists(orderListName), plant) return plant, orderList
def optimize(args): """ Runs the Scheduler with the OrderList from orderListName on the Plant with plantName. """ plantName = args[0] orderListName = args[1] plant = Plant.fromXmlFile(plantFileExists(plantName)) orderList = OrderList.fromXmlFile(orderListExists(orderListName)) optimizer = Optimizer(plant, orderList) optimizer.run()
def schedule(args): """ Runs the Scheduler with the OrderList from orderListName on the Plant with plantName. """ plantName = args[0] orderListName = args[1] plant = Plant.fromXmlFile(plantFileExists(plantName)) orderList = OrderList.fromXmlFile(orderListExists(orderListName)) scheduler = Scheduler(plant, orderList) evaluator = Evaluator(plant) evaluator.evaluate(parseSolutions(scheduler.start(), orderList))
def loadPlantAndOrderList(plantName, orderListName): plant = Plant.fromXmlFile(plantFileExists(plantName)) orderList = OrderList.fromXmlFile(orderListExists(orderListName), plant) for i, m in enumerate(plant.machines): for o in orderList.orders: if o.recipe[m.name] == None: o.recipe.recipe.insert(i, [m.name, 0]) for o in orderList.orders: assert len(plant.machines) == len(o.recipe.recipe) normValue = normalizeValues(plant, orderList) return plant, orderList, normValue
def addOrder(args): """ Adds an Order along with its Recipe to an OrderList. """ orderListName = args[0] plantName = args[1] orderId = args[2] orderDeadline = args[3] plant = Plant.fromXmlFile(plantFileExists(plantName)) order = Order(id=int(orderId), deadline=int(orderDeadline)) recipe = Recipe() for m in plant.machines: print "Time for", m.name + ":", time = int(input()) recipe[m.name] = time order.recipe = recipe orderListFilename = orderListExists(orderListName) orderList = OrderList.fromXmlFile(orderListFilename) orderList.addOrder(order) orderList.toXmlFile(orderListFilename)
def createOrderList(args): """ Creates a new OrderList file with orderListName. """ OrderList().toXmlFile(orderListNoExists(args[0]))