def run_task(packs: dict): test_times = 1 if packs["method"] == 1: for i in range(test_times): population, obj = PMOEAD_bytime( file_name=packs["file_name"], dimension=packs["dimension"], population_size=packs["population_size"], max_time=packs["time"], begin=packs["begin"], end=packs["end"]) name = '[dataset_{}][method_{}][time_{}][{}]'.format( packs["name"], packs["method"], packs["time"], packs["num"]) store_result(obj, name) elif packs["method"] == 2: for i in range(test_times): population, obj = parallel_run_bytime( max_time=packs["time"], iteration_num=packs["iter"], cpu_num=packs["cores"], file_name=packs["file_name"], dimension=packs["dimension"], population_size=packs["population_size"]) name = '[dataset_{}][method_{}][time_{}][cpu_{}][{}]'.format( packs["name"], packs["method"], packs["time"], packs["cores"], packs["num"]) store_result(obj, name) elif packs["method"] == 3: for i in range(test_times): population, obj = parallel_run_bytime( max_time=packs["time"], iteration_num=packs["iter"], cpu_num=packs["cores"], file_name=packs["file_name"], dimension=packs["dimension"], population_size=packs["population_size"], overlapping_ratio=packs["overlap"]) name = '[dataset_{}][method_{}][time_{}][cpu_{}][ovlp_{}][{}]'.format( packs["name"], packs["method"], packs["time"], packs["cores"], packs["overlap"], packs["num"]) store_result(obj, name) else: for i in range(test_times): population, obj = parallel_run_bytime( max_time=packs["time"], iteration_num=packs["iter"], cpu_num=packs["cores"], file_name=packs["file_name"], dimension=packs["dimension"], population_size=packs["population_size"], overlapping_ratio=packs["overlap"], auto_adjust=True) name = '[dataset_{}][method_{}][time_{}][cpu_{}][ovlp_{}][auto][{}]'.format( packs["name"], packs["method"], packs["time"], packs["cores"], packs["overlap"], packs["num"]) store_result(obj, name)
def test_parallel_run_by_time(f, test_times, run_time, iteration_num, cpu_num, file_name, feature_num, population_size): res = [] print('run parallel', file_name, 'starts') for i in range(test_times): population, obj = parallel_run_bytime(max_time=run_time, iteration_num=iteration_num, cpu_num=cpu_num, file_name=file_name, dimension=feature_num, population_size=population_size) name = '{}_cpu{}_{}'.format(file_name[:-4], cpu_num, i) hv = store_result(obj, name) res.append((i, hv)) order = chose_file(res) name = '{}_cpu{}'.format(file_name[:-4], cpu_num) f.write('file:{} chosen:the {} file\n'.format(name, order)) print('run parallel', file_name, 'ends')
argv_i = '5000' population, obj = pmoead(file_name=directory, dimension=feature_num, population_size=population_size, max_iteration=iteration_num * round_num, begin=0, end=population_size) else: argv_p = 'PP' if _bytime: argv_t = 'TT' argv_i = '50' population, obj = parallel_run_bytime( max_time=run_time, iteration_num=iteration_num, cpu_num=cpu_num, file_name=directory, dimension=feature_num, population_size=population_size) elif _naive: argv_t = 'NA' argv_i = '5000' population, obj = naive_parallel(total_iteration=iteration_num * round_num, cpu_num=cpu_num, file_name=directory, dimension=feature_num, population_size=population_size) else: argv_t = 'NT' argv_i = 'r' + str(round_num) + 'i' + str(iteration_num)