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)
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
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 if __name__ == "__main__": result = repeat(do_exp, 4) sts = interval_statistics(result) print("Statistics: {0}".format(interval_stat_string(sts))) print(result) pass
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")
#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")
deepcopy(heft_particle) if random.random() > 1.00 else generate( _wf, rm, estimator, rankList) for _ in range(n) ]) def componoud_update(w, c1, c2, p, best, pop): mapping_update(w, c1, c2, p.mapping, best.mapping, pop) 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.1, C1=0.6, C2=0.2, GEN=10, N=20) result = repeat(exp, 1) print(result) sts = interval_statistics(result) print("Statistics: {0}".format(interval_stat_string(sts))) print("Average: {0}".format(numpy.mean(result))) pass
logbook = tools.Logbook() logbook.header = ["gen", "T", "val"] 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