예제 #1
0
def schedulerLargeValuesPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting benchmark test " + str(testNum) + " with large values",
        BLUE)
    orderList.orders = orders[:6]
    plant.machines = machines[:]
    largeValuesTimes = [0]

    for i in range(1, 10):
        pprint("PERF Large Value = " + str(i * 4), BLUE)
        for o in orderList.orders:
            o.deadline *= 4
            for r in o.recipe.recipe:
                r[1] *= 4
        scheduler = Scheduler(plant, orderList)
        t = time()
        scheduler.start()
        t = time() - t
        largeValuesTimes.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "largevalues-" + str(testNum)) + ".ps",
        largeValuesTimes, 800, 800, (255, 255, 255), 5, True, True, True, None,
        None, None, None)
예제 #2
0
def simulatorOrdersPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting simulator benchmark test " + str(testNum) +
        " on orders", BLUE)
    orderList.orders = []
    plant.machines = machines[:]
    times = [0]

    for i in range(1, len(orders) + 1):
        pprint("PERF Number of orders = " + str(i), BLUE)
        orderList.orders = orders[:i]
        optimizer = Optimizer(plant, orderList, Simulator(plant),
                              Evaluator(plant))
        schedule = optimizer.initialIndividual()
        t = time()
        simulator = Simulator(plant)
        simulator.simulate(schedule)
        t = time() - t
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "simulator-orders-" + str(testNum)) + FORMAT,
        times, 800, 800, (255, 255, 255), 5, True, True, True, None, None,
        None, None)
예제 #3
0
def schedulerOrdersPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint("PERF Starting benchmark test " + str(testNum) + " on orders", BLUE)
    orderList.orders = []
    plant.machines = machines[:]
    ordertimes = [0]

    for i in range(1, len(orders) + 1):
        pprint("PERF Number of orders = " + str(i), BLUE)
        orderList.orders = orders[:i]
        scheduler = Scheduler(plant, orderList)
        t = time()
        scheduler.start()
        t = time() - t
        ordertimes.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "orders-" + str(testNum)) + ".ps", ordertimes,
        800, 800, (255, 255, 255), 5, True, True, True, None, None, None, None)
예제 #4
0
def optimizerMachinesPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting optimizer benchmark test " + str(testNum) +
        " on machines", BLUE)
    orderList.orders = orders[:]
    recipes = []
    for o in orderList.orders:
        recipes.append(o.recipe.recipe[:])
        o.recipe.recipe = []

    plant.machines = []
    times = [0]

    for i in range(1, len(machines) + 1):
        pprint("PERF Number of machines = " + str(i), BLUE)
        plant.machines = machines[:i]
        for j, o in enumerate(orderList.orders):
            o.recipe.recipe = recipes[j][:i]
        optimizer = Optimizer(plant, orderList, Simulator(plant),
                              Evaluator(plant))
        optimizer.populationSize = 10
        optimizer.iterations = 10
        optimizer.indivMutationRate = 0.5
        optimizer.selectionRate = 0.5
        optimizer.mutationRange = 10
        t = time()
        optimizer.run()
        t = time() - t
        t -= optimizer.simulatorTime
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "optimizer-machines-" + str(testNum)) + FORMAT,
        times, 800, 800, (255, 255, 255), 5, True, True, True, None, None,
        None, None)
예제 #5
0
    def plotCairoPlot(self):
        try:
            from thirdparty.CairoPlot import dot_line_plot
        except:
            pprint("PERF Will not output to graph. Install CairoPlot.", RED)
            return

        dot_line_plot(
            path.join(
                "benchmarks", self.prefix + "-" + self.testName + "-" +
                str(self.testNumber)) + ".png", self.cairoPlotTimes, 800, 800,
            (255, 255, 255), 5, True, True, True, None, None, None, None)

        dot_line_plot(
            path.join(
                "benchmarks", self.prefix + "-" + self.testName + "-" +
                str(self.testNumber)) + ".ps", self.cairoPlotTimes, 800, 800,
            (255, 255, 255), 5, True, True, True, None, None, None, None)
예제 #6
0
def optimizerLargeValuesPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting optimizer benchmark test " + str(testNum) +
        " with large values", BLUE)
    orderList.orders = orders[:6]
    plant.machines = machines[:]
    times = [0]

    val = 2

    for i in range(1, 6):
        pprint("PERF Large Value = " + str(i * val), BLUE)
        for o in orderList.orders:
            o.deadline *= val
            for r in o.recipe.recipe:
                r[1] *= val
        optimizer = Optimizer(plant, orderList, Simulator(plant),
                              Evaluator(plant))
        optimizer.populationSize = 5
        optimizer.iterations = 5
        optimizer.indivMutationRate = 0.5
        optimizer.selectionRate = 0.5
        optimizer.mutationRange = 500
        t = time()
        optimizer.run()
        t = time() - t
        t -= optimizer.simulatorTime
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "optimizer-largevalues-" + str(testNum)) +
        FORMAT, times, 800, 800, (255, 255, 255), 5, True, True, True, None,
        None, None, None)
예제 #7
0
def simulatorLargeValuesPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting simulator benchmark test " + str(testNum) +
        " with large values", BLUE)
    orderList.orders = orders[:]
    plant.machines = machines[:]
    times = [0]

    val = 4

    for i in range(1, 7):
        pprint("PERF Large Value = " + str(i * val), BLUE)
        for o in orderList.orders:
            o.deadline *= val
            for r in o.recipe.recipe:
                r[1] *= val
        optimizer = Optimizer(plant, orderList, Simulator(plant),
                              Evaluator(plant))
        schedule = optimizer.initialIndividual()
        t = time()
        simulator = Simulator(plant)
        simulator.simulate(schedule)
        t = time() - t
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "simulator-largevalues-" + str(testNum)) +
        FORMAT, times, 800, 800, (255, 255, 255), 5, True, True, True, None,
        None, None, None)
예제 #8
0
def schedulerMachinesPerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting scheduler benchmark test " + str(testNum) +
        " on machines", BLUE)
    orderList.orders = orders[:]
    recipes = []
    for o in orderList.orders:
        recipes.append(o.recipe.recipe[:])
        o.recipe.recipe = []

    plant.machines = []
    times = [0]

    for i in range(1, len(machines) + 1):
        pprint("PERF Number of machines = " + str(i), BLUE)
        plant.machines = machines[:i]
        for j, o in enumerate(orderList.orders):
            o.recipe.recipe = recipes[j][:i]
        scheduler = Scheduler(plant, orderList)
        t = time()
        scheduler.start()
        t = time() - t
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "scheduler-machines-" + str(testNum)) + FORMAT,
        times, 800, 800, (255, 255, 255), 5, True, True, True, None, None,
        None, None)
예제 #9
0
def optimizerMutationRangePerf(plant, orderList, testNum):
    machines = plant.machines[:]
    orders = orderList.orders[:]

    pprint(
        "PERF Starting optimizer benchmark test " + str(testNum) +
        " on mutation range", BLUE)
    orderList.orders = orders[:]
    plant.machines = machines[:]
    times = [0]

    for i in range(10, 200, 20):
        pprint("PERF Selection rate = " + str(i), BLUE)
        optimizer = Optimizer(plant, orderList, Simulator(plant),
                              Evaluator(plant))
        optimizer.populationSize = 5
        optimizer.iterations = 5
        optimizer.indivMutationRate = 0.5
        optimizer.selectionRate = 0.5
        optimizer.mutationRange = i
        t = time()
        optimizer.run()
        t = time() - t
        t -= optimizer.simulatorTime
        times.append(t)
        pprint("PERF Time = " + str(t), GREEN)

    try:
        from thirdparty.CairoPlot import dot_line_plot
    except:
        pprint("PERF Will not output to graph.", RED)
        return

    dot_line_plot(
        path.join("benchmarks", "optimizer-mutationrange-" + str(testNum)) +
        FORMAT, times, 800, 800, (255, 255, 255), 5, True, True, True, None,
        None, None, None)