Example #1
0
        def componoud_update(w, c1, c2, p, best, pop):
            #doMap = random.random()
            #if doMap < 0.1:
            mapping_update(w, c1, c2, p.mapping, best.mapping, pop)
            #else:
            ordering_update(w, c1, c2, p.ordering, best.ordering, pop)

        toolbox = Toolbox()
        toolbox.register("population", heft_gen)
        toolbox.register("fitness", fitness, _wf, rm, estimator)
        toolbox.register("update", componoud_update)
        return toolbox

    pass


if __name__ == "__main__":
    exp = RdpsoBaseExperiment(wf_name="Epigenomics_24",
                              W=0.2,
                              C1=0.5,
                              C2=0.5,
                              GEN=300,
                              N=20)
    result = repeat(exp, 60)
    print(result)
    # result = exp()
    sts = interval_statistics(result)
    print("Statistics: {0}".format(interval_stat_string(sts)))
    print("Average: {0}".format(numpy.mean(result)))
    pass
Example #2
0
    n = 4
    execCount = 1
    data_intensive = 100

    exp_om = OmpsoBaseExperiment(
        wf_name=wf_cur,
        #exp_rd = RdpsoBaseExperiment(wf_name=wf_cur,
        W=w,
        C1=c1,
        C2=c2,
        GEN=gen,
        N=n,
        data_intensive=data_intensive)

    #result = repeat(exp_om, execCount)
    result = repeat(exp_om, execCount)

    #file = open("C:\Melnik\Experiments\Work\PSO_compare\populations\OM cyber.txt", 'w')
    #file.write("#w = " + str(w) + " c1 = " + str(c1) + " c2 = " + str(c2) + "\n")
    #file.write("#gen    result" + "\n")

    res_list = [0 for _ in range(gen)]
    for i in range(execCount):
        cur_list = result[i][1]
        print(str(cur_list))
        for j in range(gen):
            res_list[j] = res_list[j] + cur_list[j]

    res_list = [x / execCount for x in res_list]
    print("res_list = " + str(res_list))
    #for i in range(gen):
Example #3
0
    heft_schedule = run_heft(_wf, rm, estimator)
    heft_makespan = Utility.makespan(heft_schedule)
    overall_transfer = Utility.overall_transfer_time(heft_schedule, _wf,
                                                     estimator)
    overall_execution = Utility.overall_execution_time(heft_schedule)

    print(
        "Heft makespan: {0}, Overall transfer time: {1}, Overall execution time: {2}"
        .format(heft_makespan, overall_transfer, overall_execution))

    if not only_heft:
        exec_count = 100
        gen = PARAMS["ga_params"]["generations"]
        res_list = [0 for _ in range(gen)]
        result = repeat(do_exp_heft_schedule, exec_count)
        mean = numpy.mean([makespan for (makespan, list) in result])
        for i in range(exec_count):
            cur_list = result[i][1]
            print(str(cur_list))
            for j in range(gen):
                res_list[j] = res_list[j] + cur_list[j]
        for j in range(gen):
            res_list[j] = res_list[j] / exec_count
        print(str(res_list))

        #file = open("C:\Melnik\Experiments\Work\PSO_compare\populations\GA with HEFT cyber.txt", 'w')
        #file.write("#gen    result" + "\n")
        #for i in range(gen):
        #    file.write(str(i) + "   " + str(res_list[i]) + "\n")

        #for (profit, trans) in profit_list:
        #    file.write(str(profit) + "    " + str(trans) + "\n")   `
    w = 0.1
    c1 = 0.6
    c2 = 0.2
    gen = 300
    n = 20
    fileRes = open("F:\eScience\Work\experiments\OMPSOvsRDPSO\Sipht_30 c1_06 c2_02 gen_300 n_20 FILTER only RD TEST.txt", 'w')
    fileInfo = open("F:\eScience\Work\experiments\OMPSOvsRDPSO\Sipht_30 c1_06 c2_02 gen_300 n_20 FILTER info only RD TEST.txt", 'w')

    exp_om = OmpsoBaseExperiment(wf_name=wf_list[0],
                              W=w, C1=c1, C2=c2,
                              GEN=gen, N=n)
    result2 = repeat(exp_om, 100)
    sts2 = interval_statistics(result2)
    #for w in [x / 10 for x in range(15)]:
    for _ in [1]:
        print(w)
        wf_cur = wf_list[0]
        print(wf_cur)
        exp_rd = RdpsoBaseExperiment(wf_name=wf_cur,
                              W=0.1, C1=0.6, C2=0.2,
                              GEN=gen, N=n)

        result1 = repeat(exp_rd, 100)
        sts1 = interval_statistics(result1)


        fileInfo.write("OM " + str(w) + " " + str(sts2) + "\n")
        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


if __name__ == "__main__":
    result = repeat(do_exp, 4)

    sts = interval_statistics(result)
    print("Statistics: {0}".format(interval_stat_string(sts)))
    print(result)
    pass
stats = tools.Statistics(lambda ind: ind.energy.values[0])
stats.register("val", lambda arr: arr[0])


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


if __name__ == "__main__":
    result = repeat(do_exp, 10)
    print(result)
    print("Mean: {0}".format(numpy.mean(result)))
    pass
            jobs_copy = jobslist.copy()
            total_job_rate = 0
            total_runtime = 0
            total_datasize = 0
            for it in range(len(jobs_copy)):
                job = jobs_copy.pop()
                cur_datasize = 0
                for file in job.input_files.items():
                    cur_datasize = cur_datasize + file[1].size
                total_job_rate = total_job_rate + (cur_datasize / job.runtime)
                total_runtime = total_runtime + job.runtime
                total_datasize = total_datasize + cur_datasize
            total_job_rate = total_job_rate / len(jobslist)
            total_runtime = total_runtime / len(jobslist)
            total_datasize = total_datasize / len(jobslist)

            return total_job_rate


if __name__ == "__main__":
    exp = OmpsoBaseExperiment(wf_name="_30",
                              W=0.5, C1=1.6, C2=1.2,
                              GEN=100, N=50, data_intensive=100)
    result = repeat(exp, 8)
    print(result)
    sts = interval_statistics(result)
    print("Statistics: {0}".format(interval_stat_string(sts)))
    print("Average: {0}".format(numpy.mean(result)))
    pass

Example #8
0
        #curFileOM = open("C:\Melnik\Experiments\Work\PSO_compare\\result\\" + wf_cur + "\\" +  "OM w_0.2 c1_0.6 c2_test gen_300 n_20.txt", 'w')
        #curFileRD = open("C:\Melnik\Experiments\Work\PSO_compare\\result\\" + wf_cur + "\\" +  "RD w_0.2 c1_0.6 c2_test gen_300 n_20.txt", 'w')
        #curFileRD2 = open("C:\Melnik\Experiments\Work\PSO_compare\\result\\" + wf_cur + "\\" +  "RD2 w_0.2 c1_0.6 c2_test gen_300 n_20.txt", 'w')
        #curFile.write("#C1    OM    RD    RDwithMap    Heft" + "\n")
        #for wcur in [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
        #c2 = wcur
        #print(c2)

        exp_om = OmpsoBaseExperiment(wf_name=wf_cur,
                                     W=w,
                                     C1=c1,
                                     C2=c2,
                                     GEN=gen,
                                     N=n,
                                     data_intensive=100)
        result2 = repeat(exp_om, execCount)
        sts2 = interval_statistics([makespan for (makespan, pop) in result2])

        #print("    om finish")

        exp_rd = RdpsoBaseExperiment(wf_name=wf_cur,
                                     W=w,
                                     C1=c1,
                                     C2=c2,
                                     GEN=gen,
                                     N=n,
                                     data_intensive=100)
        result1 = repeat(exp_rd, execCount)
        sts1 = interval_statistics([makespan for (makespan, pop) in result1])

        #print("    rd finish")