Пример #1
0
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
Пример #2
0
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()
Пример #3
0
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))
Пример #4
0
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
Пример #5
0
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)
Пример #6
0
def createOrderList(args):
    """
	Creates a new OrderList file with orderListName.
	"""
    OrderList().toXmlFile(orderListNoExists(args[0]))