Example #1
0
    def __call__(self):

        toolbox, stats, logbook = self.toolbox(), self.stats(), self.logbook()
        _wf, rm, estimator = self.env()
        heft_schedule = self.heft_schedule()

        pop, log, best = om.run_pso(
            toolbox=toolbox,
            logbook=logbook,
            stats=stats,
            gen_curr=0,
            gen_step=self.GEN,
            invalidate_fitness=True,
            initial_pop=None,
            w=self.W,
            c1=self.C1,
            c2=self.C2,
            n=self.N,
        )

        schedule = om_order.build_schedule(_wf, rm, estimator, best)

        Utility.validate_static_schedule(_wf, schedule)
        makespan = Utility.makespan(schedule)
        #print("Final makespan: {0}".format(makespan))
        #print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
        return makespan
Example #2
0
def do_exp():
    pop, _logbook, best = run_gsa(toolbox, stats, logbook, pop_size, 0, iter_number, None, kbest, ginit, **{"w":W, "c":C})

    schedule = build_schedule(_wf, rm, estimator,  best)
    Utility.validate_static_schedule(_wf, schedule)
    makespan = Utility.makespan(schedule)
    print("Final makespan: {0}".format(makespan))
    print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
    return makespan
Example #3
0
def do_exp_PEFT(wf_name, trans):
    _wf = wf(wf_name)
    estimator.transfer_time = trans
    #estim = SimpleTimeCostEstimator(comp_time_cost=0, transf_time_cost=0, transferMx=None,
    #                                ideal_flops=20, transfer_time=trans)

    peft_schedule = run_peft(_wf, rm, estimator)
    #return peft_schedule
    Utility.validate_static_schedule(_wf, peft_schedule)

    makespan = Utility.makespan(peft_schedule)
    return makespan
def do_exp():
    best, log, current = run_sa(
        toolbox=toolbox,
        logbook=logbook,
        stats=stats,
        initial_solution=initial_state, T=T, N=N
    )

    solution = {MAPPING_SPECIE: [item for item in best.mapping.items()], ORDERING_SPECIE: best.ordering}
    schedule = build_schedule(_wf, estimator, rm, solution)
    Utility.validate_static_schedule(_wf, schedule)
    makespan = Utility.makespan(schedule)
    heft_makespan = Utility.makespan(heft_schedule)
    print("Final makespan: {0}".format(makespan))
    print("Heft makespan: {0}".format(heft_makespan))
    return makespan
Example #5
0
    def __call__(self):

        stats, logbook = self.stats(), self.logbook()
        _wf, rm, estimator = self.env()
        estimator.transfer_time = 500
        heft_schedule = self.heft_schedule()

        wf_dag = HeftHelper.convert_to_parent_children_map(_wf)
        jobs = set(wf_dag.keys()) | set(x for xx in wf_dag.values()
                                        for x in xx)
        nodes = rm.get_nodes()
        mapMatrix = initMapMatrix(jobs, nodes, estimator)
        rankList = initRankList(wf_dag, nodes, estimator)
        ordFilter = filterList(_wf)

        toolbox = self.toolbox(mapMatrix, rankList, ordFilter)

        pop, log, best = run_pso(
            toolbox=toolbox,
            logbook=logbook,
            stats=stats,
            gen_curr=0,
            gen_step=self.GEN,
            invalidate_fitness=True,
            initial_pop=None,
            w=self.W,
            c1=self.C1,
            c2=self.C2,
            n=self.N,
            rm=rm,
            wf=_wf,
            estimator=estimator,
            mapMatrix=mapMatrix,
            rankList=rankList,
            ordFilter=ordFilter,
        )
        #print(str(best.fitness))
        schedule = build_schedule(_wf, rm, estimator, best, mapMatrix,
                                  rankList, ordFilter)
        Utility.validate_static_schedule(_wf, schedule)
        makespan = Utility.makespan(schedule)
        if makespan > best.fitness.values[0]:
            print("DANGER!!!!!!!!!!!!!!!!!")
        print("Final makespan: {0}".format(makespan))
        print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
        return makespan
Example #6
0
    def __call__(self):

        stats, logbook = self.stats(), self.logbook()
        _wf, rm, estimator = self.env()

        wf_dag = HeftHelper.convert_to_parent_children_map(_wf)
        heft_schedule = self.heft_schedule()
        nodes = rm.get_nodes()
        rankList = initRankList(wf_dag, nodes, estimator)

        toolbox = self.toolbox(rankList)

        pop, log, best = run_pso(
            toolbox=toolbox,
            logbook=logbook,
            stats=stats,
            gen_curr=0,
            gen_step=self.GEN,
            invalidate_fitness=True,
            initial_pop=None,
            w=self.W,
            c1=self.C1,
            c2=self.C2,
            n=self.N,
            rm=rm,
            wf=_wf,
            estimator=estimator,
            rankList=rankList,
        )

        #schedule = build_schedule(_wf, rm, estimator,  best, mapMatrix, rankList, ordFilter)
        schedule = build_schedule(_wf, rm, estimator, best, rankList)
        Utility.validate_static_schedule(_wf, schedule)
        makespan = Utility.makespan(schedule)
        if (makespan > best.fitness.values[0]):
            print(
                "DANGER!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
            )
        #print("Final makespan: {0}".format(makespan))
        #print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
        return makespan
def do_exp():

    pop, log, best = run_pso(
        toolbox=toolbox,
        logbook=logbook,
        stats=stats,
        gen_curr=0, gen_step=GEN, invalidate_fitness=True, initial_pop=None,
        w=W, c1=C1, c2=C2, n=N,
    )



    solution = construct_solution(best, sorted_tasks)
    schedule = build_schedule(_wf, estimator, rm, solution)

    Utility.validate_static_schedule(_wf, schedule)

    makespan = Utility.makespan(schedule)
    print("Final makespan: {0}".format(makespan))
    print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
    return makespan
Example #8
0
    def __call__(self):

        toolbox, stats, logbook = self.toolbox(), self.stats(), self.logbook()
        _wf, rm, estimator = self.env()
        heft_schedule = self.heft_schedule()

        pop, log, best = run_gsa(toolbox=toolbox,
                                 logbook=logbook,
                                 statistics=stats,
                                 n=self.N,
                                 iter_number=self.GEN,
                                 kbest=self.KBEST,
                                 ginit=self.G)

        schedule = build_schedule(_wf, rm, estimator, best)

        Utility.validate_static_schedule(_wf, schedule)
        makespan = Utility.makespan(schedule)
        print("Final makespan: {0}".format(makespan))
        print("Heft makespan: {0}".format(Utility.makespan(heft_schedule)))
        return makespan
Example #9
0
 def _validate(self, wf, estimator, schedule):
     max_makespan = Utility.makespan(schedule)
     seq_time_validaty = Utility.validateNodesSeq(schedule)
     sched = deepcopy(schedule)
     mark_finished(sched)
     Utility.validate_static_schedule(wf, schedule)