Exemplo n.º 1
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)
Exemplo n.º 2
0
 def bench(self):
     orders = self.orderList.orders[:]
     self.orderList.orders = []
     i = self.startValue
     while i <= len(orders):
         pprint("PERF Number of orders = " + str(i), BLUE)
         self.orderList.orders = orders[:i]
         optimizer = Optimizer(self.plant, self.orderList,
                               Simulator(self.plant), Evaluator(self.plant))
         schedule = optimizer.initialIndividual()
         t = time()
         simulator = Simulator(self.plant)
         simulator.simulate(schedule)
         t = time() - t
         self.addCairoPlotTime(t)
         self.addGnuPlotTime(i, t)
         i += 1
Exemplo n.º 3
0
 def bench(self):
     val = 4
     i = self.startValue
     while i <= 6:
         pprint("PERF Large Value = " + str(i * val), BLUE)
         for o in self.orderList.orders:
             o.deadline *= val
             for r in o.recipe.recipe:
                 r[1] *= val
         optimizer = Optimizer(self.plant, self.orderList,
                               Simulator(self.plant), Evaluator(self.plant))
         schedule = optimizer.initialIndividual()
         t = time()
         simulator = Simulator(self.plant)
         simulator.simulate(schedule)
         t = time() - t
         self.addCairoPlotTime(t)
         self.addGnuPlotTime((i + 1) * val, t)
         i += 1
Exemplo n.º 4
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)
Exemplo n.º 5
0
    def bench(self):
        recipes = []
        for o in self.orderList.orders:
            recipes.append(o.recipe.recipe[:])
            o.recipe.recipe = []

        machines = self.plant.machines[:]
        self.plant.machines = []
        i = self.startValue
        while i <= len(machines):
            pprint("PERF Number of machines = " + str(i), BLUE)
            self.plant.machines = machines[:i]
            for j, o in enumerate(self.orderList.orders):
                o.recipe.recipe = recipes[j][:i]
            optimizer = Optimizer(self.plant, self.orderList,
                                  Simulator(self.plant), Evaluator(self.plant))
            schedule = optimizer.initialIndividual()
            t = time()
            simulator = Simulator(self.plant)
            simulator.simulate(schedule)
            t = time() - t
            self.addCairoPlotTime(t)
            self.addGnuPlotTime(i, t)
            i += 1